Bug 1000736 - Throw a error if an app tries to record a video from a video file being transcoded into a stream. r=tterribe.
authorRandy Lin <rlin@mozilla.com>
Tue, 29 Apr 2014 11:34:43 +0800
changeset 181074 679f46bdebae56524933bd0c50a02b0baa86a78b
parent 181073 42daf38dc3f3d82bb35f19bcf6d8960f3b464fb1
child 181075 c1c7e0011be70e9650f34904311204f0c75b109c
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewerstterribe
bugs1000736
milestone32.0a1
Bug 1000736 - Throw a error if an app tries to record a video from a video file being transcoded into a stream. r=tterribe.
content/media/encoder/TrackEncoder.cpp
--- a/content/media/encoder/TrackEncoder.cpp
+++ b/content/media/encoder/TrackEncoder.cpp
@@ -159,16 +159,24 @@ VideoTrackEncoder::NotifyQueuedTrackChan
    // Check and initialize parameters for codec encoder.
   if (!mInitialized) {
     VideoSegment::ChunkIterator iter(const_cast<VideoSegment&>(video));
     while (!iter.IsEnded()) {
       VideoChunk chunk = *iter;
       if (!chunk.IsNull()) {
         gfx::IntSize imgsize = chunk.mFrame.GetImage()->GetSize();
         gfxIntSize intrinsicSize = chunk.mFrame.GetIntrinsicSize();
+#ifdef MOZ_WIDGET_GONK
+        // Block the video frames come from video source.
+        if (chunk.mFrame.GetImage()->GetFormat() != ImageFormat::PLANAR_YCBCR) {
+          LOG("Can't encode this ImageFormat %x", chunk.mFrame.GetImage()->GetFormat());
+          NotifyCancel();
+          break;
+        }
+#endif
         nsresult rv = Init(imgsize.width, imgsize.height,
                            intrinsicSize.width, intrinsicSize.height,
                            aTrackRate);
         if (NS_FAILED(rv)) {
           LOG("[VideoTrackEncoder]: Fail to initialize the encoder!");
           NotifyCancel();
         }
         break;