mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1141914: Always use video dimensions using extradata's SPS. r=cpearce
This commit is contained in:
parent
d1005603c2
commit
8dc6a67237
@ -44,6 +44,7 @@ private:
|
||||
nsresult CreateDecoder();
|
||||
nsresult CreateDecoderAndInit(mp4_demuxer::MP4Sample* aSample);
|
||||
nsresult CheckForSPSChange(mp4_demuxer::MP4Sample* aSample);
|
||||
void UpdateConfigFromExtraData(mp4_demuxer::ByteBuffer* aExtraData);
|
||||
|
||||
nsRefPtr<PlatformDecoderModule> mPDM;
|
||||
mp4_demuxer::VideoDecoderConfig mCurrentConfig;
|
||||
@ -177,6 +178,8 @@ AVCCMediaDataDecoder::CreateDecoder()
|
||||
// nothing found yet, will try again later
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
UpdateConfigFromExtraData(mCurrentConfig.extra_data);
|
||||
|
||||
mDecoder = mPDM->CreateVideoDecoder(mCurrentConfig,
|
||||
mLayersBackend,
|
||||
mImageContainer,
|
||||
@ -197,15 +200,7 @@ AVCCMediaDataDecoder::CreateDecoderAndInit(mp4_demuxer::MP4Sample* aSample)
|
||||
if (!mp4_demuxer::AnnexB::HasSPS(extra_data)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
mp4_demuxer::SPSData spsdata;
|
||||
if (mp4_demuxer::H264::DecodeSPSFromExtraData(extra_data, spsdata) &&
|
||||
spsdata.pic_width > 0 && spsdata.pic_height > 0) {
|
||||
mCurrentConfig.image_width = spsdata.pic_width;
|
||||
mCurrentConfig.image_height = spsdata.pic_height;
|
||||
mCurrentConfig.display_width = spsdata.display_width;
|
||||
mCurrentConfig.display_height = spsdata.display_height;
|
||||
}
|
||||
mCurrentConfig.extra_data = extra_data;
|
||||
UpdateConfigFromExtraData(extra_data);
|
||||
|
||||
nsresult rv = CreateDecoder();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -238,6 +233,20 @@ AVCCMediaDataDecoder::CheckForSPSChange(mp4_demuxer::MP4Sample* aSample)
|
||||
return CreateDecoderAndInit(aSample);
|
||||
}
|
||||
|
||||
void
|
||||
AVCCMediaDataDecoder::UpdateConfigFromExtraData(mp4_demuxer::ByteBuffer* aExtraData)
|
||||
{
|
||||
mp4_demuxer::SPSData spsdata;
|
||||
if (mp4_demuxer::H264::DecodeSPSFromExtraData(aExtraData, spsdata) &&
|
||||
spsdata.pic_width > 0 && spsdata.pic_height > 0) {
|
||||
mCurrentConfig.image_width = spsdata.pic_width;
|
||||
mCurrentConfig.image_height = spsdata.pic_height;
|
||||
mCurrentConfig.display_width = spsdata.display_width;
|
||||
mCurrentConfig.display_height = spsdata.display_height;
|
||||
}
|
||||
mCurrentConfig.extra_data = aExtraData;
|
||||
}
|
||||
|
||||
// AVCCDecoderModule
|
||||
|
||||
AVCCDecoderModule::AVCCDecoderModule(PlatformDecoderModule* aPDM)
|
||||
|
Loading…
Reference in New Issue
Block a user