Bug 1297307 - Add extra video duration element for EOS sample. r=snorp

MozReview-Commit-ID: 4QUTABCNT06

--HG--
extra : rebase_source : db9a186de79d9fe6a307ffb125f980609224dfdc
This commit is contained in:
John Lin 2016-08-30 17:40:49 +08:00
parent ff6fbed7e1
commit 077d1abae1
2 changed files with 12 additions and 4 deletions

View File

@ -149,7 +149,7 @@ public:
NS_ENSURE_TRUE_VOID(ok);
if (size > 0) {
if (size > 0 && durationUs.value() > 0) {
RefPtr<layers::Image> img =
new SurfaceTextureImage(mDecoder->mSurfaceTexture.get(), mDecoder->mConfig.mDisplay,
gl::OriginPos::BottomLeft);
@ -171,7 +171,6 @@ public:
if ((flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM) != 0) {
mDecoderCallback->DrainComplete();
return;
}
}
@ -223,6 +222,15 @@ public:
return RemoteDataDecoder::Flush();
}
nsresult Drain() override
{
nsresult res = RemoteDataDecoder::Drain();
NS_ENSURE_SUCCESS(res, res);
mInputDurations.Put(0);
return NS_OK;
}
nsresult Input(MediaRawData* aSample) override
{
nsresult res = RemoteDataDecoder::Input(aSample);
@ -440,7 +448,7 @@ RemoteDataDecoder::Drain()
bufferInfo->Set(0, 0, -1, MediaCodec::BUFFER_FLAG_END_OF_STREAM);
mJavaDecoder->Input(nullptr, bufferInfo);
return NS_ERROR_FAILURE;
return NS_OK;
}
nsresult

View File

@ -39,7 +39,7 @@ public final class Sample implements Parcelable {
}
public boolean isDummy() {
return bytes == null && info.size == 0;
return !isEOS() && bytes == null && info.size == 0;
}
public boolean isEOS() {