Skip to content

Commit

Permalink
convert the metadata to uint8 like other sound data buffers so we can…
Browse files Browse the repository at this point in the history
… aggregate them

git-svn-id: https://xpra.org/svn/Xpra/trunk@15710 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 25, 2017
1 parent 89f40ef commit 8a42771
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ XpraClient.prototype._process_sound_data_aurora = function(packet) {
if(metadata) {
//push metadata first:
for(var i = 0; i < metadata.length; i++) {
this.audio_aurora_ctx.asset.source._on_data(metadata[i]);
this.audio_aurora_ctx.asset.source._on_data(Utilities.StringToUint8(metadata[i]));
}
}
this.audio_aurora_ctx.asset.source._on_data(buf);
Expand Down Expand Up @@ -1929,7 +1929,7 @@ XpraClient.prototype._process_sound_data_mediasource = function(packet) {
if(metadata) {
//push metadata first:
for(var i = 0; i < metadata.length; i++) {
this.audio_buffers.push(metadata[i]);
this.audio_buffers.push(Utilities.StringToUint8(metadata[i]));
}
//since we have the metadata, we should be good to go:
MIN_START_BUFFERS = 1;
Expand Down
8 changes: 8 additions & 0 deletions src/html5/js/Utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ var Utilities = {
window.URL.revokeObjectURL(url);
},

StringToUint8 : function(str) {
var u8a = new Uint8Array(str.length);
for(var i=0,j=str.length;i<j;++i){
u8a[i] = str.charCodeAt(i);
}
return u8a;
},

Uint8ToString : function(u8a){
var CHUNK_SZ = 0x8000;
var c = [];
Expand Down

0 comments on commit 8a42771

Please sign in to comment.