Issue #2393 - Part 3 - Remove extra copy of YUV buffer on Windows

This commit is contained in:
trav90 2023-11-28 14:41:34 -06:00 • committed by roytam1
commit b09b3771c6
9 changed files with 70 additions and 20 deletions

View file

@ -38,7 +38,8 @@ ogg_packet InitTheoraPacket(const unsigned char* aData, size_t aLength,
}
TheoraDecoder::TheoraDecoder(const CreateDecoderParams& aParams)
: mImageContainer(aParams.mImageContainer)
: mImageAllocator(aParams.mKnowsCompositor)
, mImageContainer(aParams.mImageContainer)
, mTaskQueue(aParams.mTaskQueue)
, mCallback(aParams.mCallback)
, mIsFlushing(false)
@ -176,7 +177,8 @@ TheoraDecoder::DoDecode(MediaRawData* aSample)
aSample->mKeyframe,
aSample->mTimecode,
mInfo.ScaledImageRect(mTheoraInfo.frame_width,
mTheoraInfo.frame_height));
mTheoraInfo.frame_height),
mImageAllocator);
if (!v) {
LOG("Image allocation error source %ldx%ld display %ldx%ld picture %ldx%ld",
mTheoraInfo.frame_width, mTheoraInfo.frame_height, mInfo.mDisplay.width, mInfo.mDisplay.height,

View file

@ -43,6 +43,7 @@ private:
MediaResult DoDecode(MediaRawData* aSample);
void ProcessDrain();
RefPtr<KnowsCompositor> mImageAllocator;
RefPtr<ImageContainer> mImageContainer;
RefPtr<TaskQueue> mTaskQueue;
MediaDataDecoderCallback* mCallback;

View file

@ -69,6 +69,7 @@ InitContext(vpx_codec_ctx_t* aCtx,
VPXDecoder::VPXDecoder(const CreateDecoderParams& aParams)
: mImageContainer(aParams.mImageContainer)
, mImageAllocator(aParams.mKnowsCompositor)
, mTaskQueue(aParams.mTaskQueue)
, mCallback(aParams.mCallback)
, mIsFlushing(false)
@ -149,7 +150,7 @@ VPXDecoder::DoDecode(MediaRawData* aSample)
"WebM image format not I420 or I444");
NS_ASSERTION(!alpha_decoded,
"Multiple frames per packet that contains alpha");
if (aSample->AlphaSize() > 0) {
if(!alpha_decoded){
MediaResult rv = DecodeAlpha(&img_alpha, aSample);
@ -221,7 +222,8 @@ VPXDecoder::DoDecode(MediaRawData* aSample)
aSample->mKeyframe,
aSample->mTimecode,
mInfo.ScaledImageRect(img->d_w,
img->d_h));
img->d_h),
mImageAllocator);
} else {
VideoData::YCbCrBuffer::Plane alpha_plane;
alpha_plane.mData = img_alpha->planes[0];

View file

@ -61,6 +61,7 @@ private:
MediaRawData* aSample);
const RefPtr<ImageContainer> mImageContainer;
RefPtr<layers::KnowsCompositor> mImageAllocator;
const RefPtr<TaskQueue> mTaskQueue;
MediaDataDecoderCallback* mCallback;
Atomic<bool> mIsFlushing;