Commit 9ee3030b by eguven Committed by Oliver Woodman

Opus initialization data should be in native order.

http://developer.android.com/reference/android/media/MediaCodec.html#CSD
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121957004
parent 58c0ab17
...@@ -258,6 +258,9 @@ import java.util.Locale; ...@@ -258,6 +258,9 @@ import java.util.Locale;
"https://storage.googleapis.com/exoplayer-test-media-1/ogg/play.ogg", Util.TYPE_OTHER), "https://storage.googleapis.com/exoplayer-test-media-1/ogg/play.ogg", Util.TYPE_OTHER),
new Sample("Google Glass (WebM Video with Vorbis Audio)", new Sample("Google Glass (WebM Video with Vorbis Audio)",
"http://demos.webmproject.org/exoplayer/glass_vp9_vorbis.webm", Util.TYPE_OTHER), "http://demos.webmproject.org/exoplayer/glass_vp9_vorbis.webm", Util.TYPE_OTHER),
new Sample("Google Glass DASH - VP9 and Opus",
"http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_opus.mpd",
Util.TYPE_DASH),
new Sample("Big Buck Bunny (FLV Video)", new Sample("Big Buck Bunny (FLV Video)",
"http://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0", Util.TYPE_OTHER), "http://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0", Util.TYPE_OTHER),
}; };
......
...@@ -115,9 +115,9 @@ import java.util.List; ...@@ -115,9 +115,9 @@ import java.util.List;
throw new OpusDecoderException("Invalid Codec Delay or Seek Preroll"); throw new OpusDecoderException("Invalid Codec Delay or Seek Preroll");
} }
long codecDelayNs = long codecDelayNs =
ByteBuffer.wrap(initializationData.get(1)).order(ByteOrder.LITTLE_ENDIAN).getLong(); ByteBuffer.wrap(initializationData.get(1)).order(ByteOrder.nativeOrder()).getLong();
long seekPreRollNs = long seekPreRollNs =
ByteBuffer.wrap(initializationData.get(2)).order(ByteOrder.LITTLE_ENDIAN).getLong(); ByteBuffer.wrap(initializationData.get(2)).order(ByteOrder.nativeOrder()).getLong();
headerSkipSamples = nsToSamples(codecDelayNs); headerSkipSamples = nsToSamples(codecDelayNs);
headerSeekPreRollSamples = nsToSamples(seekPreRollNs); headerSeekPreRollSamples = nsToSamples(seekPreRollNs);
} else { } else {
......
...@@ -737,9 +737,9 @@ public final class MatroskaExtractorTest extends InstrumentationTestCase { ...@@ -737,9 +737,9 @@ public final class MatroskaExtractorTest extends InstrumentationTestCase {
android.test.MoreAsserts.assertEquals(TEST_OPUS_CODEC_PRIVATE, android.test.MoreAsserts.assertEquals(TEST_OPUS_CODEC_PRIVATE,
format.initializationData.get(0)); format.initializationData.get(0));
assertEquals(TEST_CODEC_DELAY, ByteBuffer.wrap(format.initializationData.get(1)) assertEquals(TEST_CODEC_DELAY, ByteBuffer.wrap(format.initializationData.get(1))
.order(ByteOrder.LITTLE_ENDIAN).getLong()); .order(ByteOrder.nativeOrder()).getLong());
assertEquals(TEST_SEEK_PRE_ROLL, ByteBuffer.wrap(format.initializationData.get(2)) assertEquals(TEST_SEEK_PRE_ROLL, ByteBuffer.wrap(format.initializationData.get(2))
.order(ByteOrder.LITTLE_ENDIAN).getLong()); .order(ByteOrder.nativeOrder()).getLong());
} else if (MimeTypes.AUDIO_VORBIS.equals(expectedMimeType)) { } else if (MimeTypes.AUDIO_VORBIS.equals(expectedMimeType)) {
assertEquals(2, format.initializationData.size()); assertEquals(2, format.initializationData.size());
assertEquals(TEST_VORBIS_INFO_SIZE, format.initializationData.get(0).length); assertEquals(TEST_VORBIS_INFO_SIZE, format.initializationData.get(0).length);
......
...@@ -1255,9 +1255,9 @@ public final class MatroskaExtractor implements Extractor { ...@@ -1255,9 +1255,9 @@ public final class MatroskaExtractor implements Extractor {
initializationData = new ArrayList<>(3); initializationData = new ArrayList<>(3);
initializationData.add(codecPrivate); initializationData.add(codecPrivate);
initializationData.add( initializationData.add(
ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(codecDelayNs).array()); ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(codecDelayNs).array());
initializationData.add( initializationData.add(
ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(seekPreRollNs).array()); ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(seekPreRollNs).array());
break; break;
case CODEC_ID_AAC: case CODEC_ID_AAC:
mimeType = MimeTypes.AUDIO_AAC; mimeType = MimeTypes.AUDIO_AAC;
......
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 sign in to comment