mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Only use ALAC workaround if sample rate is 0
This prevents the workaround from occuring once FFmpeg has the bug patched.
This commit is contained in:
parent
f7b2452d46
commit
6becba8c42
@ -88,14 +88,13 @@ import java.util.List;
|
|||||||
}
|
}
|
||||||
if (!hasOutputFormat) {
|
if (!hasOutputFormat) {
|
||||||
channelCount = ffmpegGetChannelCount(nativeContext);
|
channelCount = ffmpegGetChannelCount(nativeContext);
|
||||||
if ("alac".equals(codecName)) {
|
sampleRate = ffmpegGetSampleRate(nativeContext);
|
||||||
|
if (sampleRate == 0 && "alac".equals(codecName)) {
|
||||||
// ALAC decoder did not set the sample rate in earlier versions of FFMPEG.
|
// ALAC decoder did not set the sample rate in earlier versions of FFMPEG.
|
||||||
// See https://trac.ffmpeg.org/ticket/6096
|
// See https://trac.ffmpeg.org/ticket/6096
|
||||||
ParsableByteArray parsableExtraData = new ParsableByteArray(extraData);
|
ParsableByteArray parsableExtraData = new ParsableByteArray(extraData);
|
||||||
parsableExtraData.setPosition(extraData.length - 4);
|
parsableExtraData.setPosition(extraData.length - 4);
|
||||||
sampleRate = parsableExtraData.readUnsignedIntToInt();
|
sampleRate = parsableExtraData.readUnsignedIntToInt();
|
||||||
} else {
|
|
||||||
sampleRate = ffmpegGetSampleRate(nativeContext);
|
|
||||||
}
|
}
|
||||||
hasOutputFormat = true;
|
hasOutputFormat = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user