Bug 969289 - Treat the null image pointer as a muted frame. r=rillian
authorBenjamin Chen <bechen@mozilla.com>
Mon, 10 Feb 2014 11:22:03 +0800
changeset 171880 74da898d756849acf57c63964e9b46f61a209c21
parent 171879 2c010a9a5d4b1c7a4834a24cc8e8413c3bbded68
child 171881 ae8c9202a6ff35760d3577470a566ae9a61ab2a4
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersrillian
bugs969289
milestone30.0a1
Bug 969289 - Treat the null image pointer as a muted frame. r=rillian
content/media/encoder/VP8TrackEncoder.cpp
--- a/content/media/encoder/VP8TrackEncoder.cpp
+++ b/content/media/encoder/VP8TrackEncoder.cpp
@@ -241,23 +241,20 @@ void VP8TrackEncoder::PrepareMutedFrame(
   mVPXImageWrapper->planes[PLANE_V] = cr;
   mVPXImageWrapper->stride[VPX_PLANE_Y] = mFrameWidth;
   mVPXImageWrapper->stride[VPX_PLANE_U] = halfWidth;
   mVPXImageWrapper->stride[VPX_PLANE_V] = halfWidth;
 }
 
 nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk)
 {
-  if (aChunk.mFrame.GetForceBlack()) {
+  if (aChunk.mFrame.GetForceBlack() || aChunk.IsNull()) {
     PrepareMutedFrame();
   } else {
     layers::Image* img = aChunk.mFrame.GetImage();
-    if (NS_WARN_IF(!img)) {
-      return NS_ERROR_NULL_POINTER;
-    }
     ImageFormat format = img->GetFormat();
     if (format != ImageFormat::PLANAR_YCBCR) {
       VP8LOG("Unsupported video format\n");
       return NS_ERROR_FAILURE;
     }
 
     // Cast away constness b/c some of the accessors are non-const
     layers::PlanarYCbCrImage* yuv =