Skip to content

Commit

Permalink
add preferred order for codecs (and fix more subclipse mess..)
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@14414 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 14, 2016
1 parent c8a7ed1 commit deaee7f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
14 changes: 13 additions & 1 deletion src/html5/connect.html
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,24 @@ <h4 class="panel-title">Advanced options</h4>
codecs_supported["aurora:"+codec_option] = "legacy: "+aurora_codecs[codec_option];
}
}
var best_codec = audio_codec;
if(!best_codec) {
var best_distance = MediaSourceConstants.PREFERRED_CODEC_ORDER.length;
for (var codec_option in codecs_supported) {
var cs = codec_option.split(":")[1];
var distance = MediaSourceConstants.PREFERRED_CODEC_ORDER.indexOf(cs);
if(distance>=0 && distance<best_distance) {
best_codec = codec_option;
best_distance = distance;
}
}
}
for (var codec_option in codecs_supported) {
var option = document.createElement("option");
option.value = codec_option;
var description = MediaSourceConstants.CODEC_DESCRIPTION[codec_option] || codecs_supported[codec_option];
option.textContent = description;
option.selected = (audio_codec==codec_option);
option.selected = (codec_option==best_codec);
audio_codec_select.add(option);
}
if(!codecs_supported) {
Expand Down
12 changes: 0 additions & 12 deletions src/html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ XpraClient.prototype._make_hello = function() {
//video stuff we may handle later:
"encoding.video_reinit" : false,
"encoding.video_scaling" : false,
<<<<<<< .mine
"encoding.full_csc_modes" : {
"h264" : ["YUV420P"],
//"mpeg4+mp4" : ["YUV420P"],
Expand All @@ -687,17 +686,6 @@ XpraClient.prototype._make_hello = function() {
},
//"encoding.h264+mp4.YUV420P.profile" : "main",
//"encoding.h264+mp4.YUV420P.level" : "3.0",
||||||| .r14390
"encoding.full_csc_modes" : {"h264" : ["YUV420P"]},
"encoding.x264.YUV420P.profile" : "baseline",
//sound (not yet):
=======
"encoding.full_csc_modes" : {
"h264" : ["YUV420P"],
},
"encoding.x264.YUV420P.profile" : "baseline",
//sound (not yet):
>>>>>>> .r14411
"sound.receive" : true,
"sound.send" : false,
"sound.decoders" : Object.keys(this.audio_codecs),
Expand Down
16 changes: 16 additions & 0 deletions src/html5/js/MediaSourceUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ var MediaSourceConstants = {
"opus+ogg" : 'audio/ogg; codecs="opus"',
},

PREFERRED_CODEC_ORDER : [
"opus+mka", "vorbis+mka",
"opus+ogg", "vorbis+ogg",
"opus", "vorbis",
"speex+ogg", "flac+ogg",
"aac+mpeg4", "mp3+mpeg4",
"mp3", "flac", "wav", "wave",
],

READY_STATE : {
0 : "NOTHING",
1 : "METADATA",
Expand Down Expand Up @@ -158,6 +167,13 @@ var MediaSourceUtil = {
if(!codecs) {
return null;
}
var codec_options = Object.keys(codecs);
for (var i = 0; i < MediaSourceConstants.PREFERRED_CODEC_ORDER.length; i++) {
var codec_option = MediaSourceConstants.PREFERRED_CODEC_ORDER[i];
if(codec_options.indexOf(codec_option)>=0) {
return codec_option;
}
}
return Object.keys(codecs)[0];
},

Expand Down

0 comments on commit deaee7f

Please sign in to comment.