| Index: media/base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java
|
| diff --git a/media/base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java b/media/base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java
|
| index ac752d4d06b2e9c7a2e034bf0997fb5ffdeaed01..1de7e42b8d274baabc6a3e73cf1de28638d21292 100644
|
| --- a/media/base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java
|
| +++ b/media/base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java
|
| @@ -61,7 +61,14 @@ class WebAudioMediaCodecBridge {
|
|
|
| MediaFormat format = extractor.getTrackFormat(0);
|
|
|
| - int channelCount = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
|
| + // Number of channels specified in the file
|
| + int inputChannelCount = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
|
| +
|
| + // Number of channels the decoder will provide. (Not
|
| + // necessarily the same as inputChannelCount. See
|
| + // crbug.com/266006.)
|
| + int outputChannelCount = inputChannelCount;
|
| +
|
| int sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE);
|
| String mime = format.getString(MediaFormat.KEY_MIME);
|
|
|
| @@ -77,13 +84,13 @@ class WebAudioMediaCodecBridge {
|
| if (DEBUG) {
|
| Log.d(LOG_TAG, "Tracks: " + extractor.getTrackCount()
|
| + " Rate: " + sampleRate
|
| - + " Channels: " + channelCount
|
| + + " Channels: " + inputChannelCount
|
| + " Mime: " + mime
|
| + " Duration: " + durationMicroseconds + " microsec");
|
| }
|
|
|
| nativeInitializeDestination(nativeMediaCodecBridge,
|
| - channelCount,
|
| + inputChannelCount,
|
| sampleRate,
|
| durationMicroseconds);
|
|
|
| @@ -139,7 +146,8 @@ class WebAudioMediaCodecBridge {
|
| ByteBuffer buf = codecOutputBuffers[outputBufIndex];
|
|
|
| if (info.size > 0) {
|
| - nativeOnChunkDecoded(nativeMediaCodecBridge, buf, info.size);
|
| + nativeOnChunkDecoded(nativeMediaCodecBridge, buf, info.size,
|
| + inputChannelCount, outputChannelCount);
|
| }
|
|
|
| buf.clear();
|
| @@ -150,6 +158,10 @@ class WebAudioMediaCodecBridge {
|
| }
|
| } else if (outputBufIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
|
| codecOutputBuffers = codec.getOutputBuffers();
|
| + } else if (outputBufIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
|
| + MediaFormat newFormat = codec.getOutputFormat();
|
| + outputChannelCount = newFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
|
| + Log.d(LOG_TAG, "output format changed to " + newFormat);
|
| }
|
| }
|
|
|
| @@ -163,11 +175,12 @@ class WebAudioMediaCodecBridge {
|
| }
|
|
|
| private static native void nativeOnChunkDecoded(
|
| - int nativeWebAudioMediaCodecBridge, ByteBuffer buf, int size);
|
| + int nativeWebAudioMediaCodecBridge, ByteBuffer buf, int size,
|
| + int inputChannelCount, int outputChannelCount);
|
|
|
| private static native void nativeInitializeDestination(
|
| int nativeWebAudioMediaCodecBridge,
|
| - int channelCount,
|
| + int inputChannelCount,
|
| int sampleRate,
|
| long durationMicroseconds);
|
| }
|
|
|