Bug 1366706 - accepts video frames with negative timestamp but non-zero size. r=jya
authorJohn Lin <jolin@mozilla.com>
Tue, 06 Jun 2017 16:11:33 +0800
changeset 362795 0498a3f9d548b986ed103bc8bd0d32dbfa975f8c
parent 362794 60afe5db03953126ca3f6a40e7a3aab81e425556
child 362796 1766ee2089e809650c6f44f91c38fa953b335347
push id31988
push usercbook@mozilla.com
push dateThu, 08 Jun 2017 12:43:02 +0000
treeherdermozilla-central@f223e1fd2044 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1366706
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1366706 - accepts video frames with negative timestamp but non-zero size. r=jya MozReview-Commit-ID: 5QqzOesIynN
dom/media/platforms/android/RemoteDataDecoder.cpp
--- a/dom/media/platforms/android/RemoteDataDecoder.cpp
+++ b/dom/media/platforms/android/RemoteDataDecoder.cpp
@@ -107,16 +107,19 @@ public:
       BufferInfo::LocalRef info = aSample->Info();
 
       int32_t flags;
       bool ok = NS_SUCCEEDED(info->Flags(&flags));
 
       int32_t offset;
       ok &= NS_SUCCEEDED(info->Offset(&offset));
 
+      int32_t size;
+      ok &= NS_SUCCEEDED(info->Size(&size));
+
       int64_t presentationTimeUs;
       ok &= NS_SUCCEEDED(info->PresentationTimeUs(&presentationTimeUs));
 
       if (!ok) {
         HandleError(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
                                 RESULT_DETAIL("VideoCallBack::HandleOutput")));
         return;
       }
@@ -125,17 +128,17 @@ public:
       InputInfo inputInfo;
       ok = mDecoder->mInputInfos.Find(presentationTimeUs, inputInfo);
       bool isEOS = !!(flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM);
       if (!ok && !isEOS) {
         // Ignore output with no corresponding input.
         return;
       }
 
-      if (ok && presentationTimeUs >= 0) {
+      if (ok && (size > 0 || presentationTimeUs >= 0)) {
         RefPtr<layers::Image> img = new SurfaceTextureImage(
           mDecoder->mSurfaceHandle, inputInfo.mImageSize, false /* NOT continuous */,
           gl::OriginPos::BottomLeft);
 
         RefPtr<VideoData> v = VideoData::CreateFromImage(
           inputInfo.mDisplaySize, offset,
           TimeUnit::FromMicroseconds(presentationTimeUs),
           TimeUnit::FromMicroseconds(inputInfo.mDurationUs),