Bug 1150853: Part3. Do not modify provided extradata array. r=edwin

The extradata provided may be modified elsewhere, prevent potential conflict.
This commit is contained in:
Jean-Yves Avenard 2015-04-09 21:14:56 +10:00
Родитель e6858f0af5
Коммит 8a19b6772a
3 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -22,7 +22,9 @@ FFmpegAudioDecoder<LIBAV_VER>::FFmpegAudioDecoder(
, mCallback(aCallback)
{
MOZ_COUNT_CTOR(FFmpegAudioDecoder);
mExtraData = aConfig.audio_specific_config;
// Use a new DataBuffer as the object will be modified during initialization.
mExtraData = new DataBuffer;
mExtraData->AppendElements(*aConfig.audio_specific_config);
}
nsresult

Просмотреть файл

@ -96,9 +96,9 @@ FFmpegDataDecoder<LIBAV_VER>::Init()
if (mExtraData) {
mCodecContext->extradata_size = mExtraData->Length();
for (int i = 0; i < FF_INPUT_BUFFER_PADDING_SIZE; i++) {
mExtraData->AppendElement(0);
}
// FFmpeg may use SIMD instructions to access the data which reads the
// data in 32 bytes block. Must ensure we have enough data to read.
mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
mCodecContext->extradata = mExtraData->Elements();
} else {
mCodecContext->extradata_size = 0;

Просмотреть файл

@ -32,7 +32,9 @@ FFmpegH264Decoder<LIBAV_VER>::FFmpegH264Decoder(
, mDisplayHeight(aConfig.display_height)
{
MOZ_COUNT_CTOR(FFmpegH264Decoder);
mExtraData = aConfig.extra_data;
// Use a new DataBuffer as the object will be modified during initialization.
mExtraData = new DataBuffer;
mExtraData->AppendElements(*aConfig.extra_data);
}
nsresult