Bug 1297265: P8. Rework LibVPX Decoder use of InputExhausted. r?kamidphish
MozReview-Commit-ID: H7KnDpkcaeT
--- a/dom/media/platforms/agnostic/VPXDecoder.cpp
+++ b/dom/media/platforms/agnostic/VPXDecoder.cpp
@@ -116,16 +116,17 @@ VPXDecoder::DoDecode(MediaRawData* aSamp
if (vpx_codec_err_t r = vpx_codec_decode(&mVPX, aSample->Data(), aSample->Size(), nullptr, 0)) {
LOG("VPX Decode error: %s", vpx_codec_err_to_string(r));
return -1;
}
vpx_codec_iter_t iter = nullptr;
vpx_image_t *img;
+ bool didOutput = false;
while ((img = vpx_codec_get_frame(&mVPX, &iter))) {
NS_ASSERTION(img->fmt == VPX_IMG_FMT_I420 ||
img->fmt == VPX_IMG_FMT_I444,
"WebM image format not I420 or I444");
// Chroma shifts are rounded down as per the decoding examples in the SDK
VideoData::YCbCrBuffer b;
@@ -174,31 +175,33 @@ VPXDecoder::DoDecode(MediaRawData* aSamp
if (!v) {
LOG("Image allocation error source %ldx%ld display %ldx%ld picture %ldx%ld",
img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height,
mInfo.mImage.width, mInfo.mImage.height);
return -1;
}
mCallback->Output(v);
+ didOutput = true;
+ }
+ if (!didOutput) {
+ mCallback->InputExhausted();
}
return 0;
}
void
VPXDecoder::ProcessDecode(MediaRawData* aSample)
{
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
if (mIsFlushing) {
return;
}
if (DoDecode(aSample) == -1) {
mCallback->Error(MediaDataDecoderError::DECODE_ERROR);
- } else if (mTaskQueue->IsEmpty()) {
- mCallback->InputExhausted();
}
}
nsresult
VPXDecoder::Input(MediaRawData* aSample)
{
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(