Commit 67bd3bd3 authored by lionel.g.landwerlin's avatar lionel.g.landwerlin Committed by Commit bot

ppapi: examples: audio_encode: fix opus comments

The genereated Ogg/Opus files don't seem to play in Chromium (which uses
ffmpeg) while they do VLC or Gstreamer. Turns out we have the wrong flag
set on the OpusTags packet and a wrong size written for one of the strings.

BUG=none
TEST=play the generated file on Chromium

Review URL: https://codereview.chromium.org/1640703002

Cr-Commit-Position: refs/heads/master@{#371778}
parent 1619b2ce
...@@ -231,13 +231,13 @@ ...@@ -231,13 +231,13 @@
this._writePage(this._Start, buffer.byteLength); this._writePage(this._Start, buffer.byteLength);
this.buffer.appendData(buffer); this.buffer.appendData(buffer);
this._writePageChecksum(start); this._writePageChecksum(start);
this._writeCommentHeader('OpusTags'); this._writeCommentHeader();
}, },
_writeCommentHeader: function(name) { _writeCommentHeader: function(name) {
var start = this.buffer.getSize(); var start = this.buffer.getSize();
var buffer = new Uint8Array(8 + 4 + 8 + 4 + 4 + 13), i = 0; var buffer = new Uint8Array(8 + 4 + 8 + 4 + 4 + 13), i = 0;
// Opus comment header. // Opus comment header.
i += writeString(buffer, i, name); i += writeString(buffer, i, 'OpusTags');
// Vendor string. // Vendor string.
i += this._writeLengthString(buffer, i, 'Chromium'); i += this._writeLengthString(buffer, i, 'Chromium');
// User comment list length // User comment list length
...@@ -245,13 +245,13 @@ ...@@ -245,13 +245,13 @@
// User comment 0 length. // User comment 0 length.
i += this._writeLengthString(buffer, i, 'TITLE=example'); i += this._writeLengthString(buffer, i, 'TITLE=example');
this._writePage(this._Continue, buffer.byteLength); this._writePage(0, buffer.byteLength);
this.buffer.appendData(buffer); this.buffer.appendData(buffer);
this._writePageChecksum(start); this._writePageChecksum(start);
}, },
_writeLengthString: function(buffer, offset, str) { _writeLengthString: function(buffer, offset, str) {
return (writeValue(buffer, offset, 4, str.length) + return (writeValue(buffer, 4, offset, str.length) +
writeString(buffer, offset, str)); writeString(buffer, offset + 4, str));
}, },
writeData: function(data) { writeData: function(data) {
this.position += this.format.sample_per_frame / this.format.channels; this.position += this.format.sample_per_frame / this.format.channels;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment