[MM][Tizen 3.0] Fix video corruption when video resolution is changed.
authorChandan Padhi <c.padhi@samsung.com>
Wed, 25 Feb 2015 09:45:56 +0000 (15:15 +0530)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
When the resolution of video is changed from server, video was corrupted.
This patch makes MediaSourcePlayerGstreamer handle the video resolution changes.

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=11432

Change-Id: I0185c67e3a25785fe4b6866e9c708881b41578d7
Signed-off-by: msu.koo <msu.koo@samsung.com>
tizen_src/impl/media/base/tizen/media_source_player_gstreamer.cc

index 604de51..0ee7f50 100644 (file)
@@ -1296,6 +1296,24 @@ void MediaSourcePlayerGstreamer::OnNewFrameAvailable(GstSample* sample) {
   if (!gst_width_ || !gst_height_)
     GetFrameDetails();
 
+  GstCaps* caps = gst_sample_get_caps(sample);
+  if (caps) {
+    GstVideoInfo vi;
+    gst_video_info_from_caps(&vi, caps);
+    int width = GST_VIDEO_INFO_WIDTH(&vi);
+    int height = GST_VIDEO_INFO_HEIGHT(&vi);
+
+    if (width != gst_width_|| height != gst_height_) {
+      LOG (INFO) << __FUNCTION__
+                 << " ###### from " << gst_width_ << "X" << gst_height_
+                 << " to " << width << "X" << height;
+      gst_width_ = width;
+      gst_height_ = height;
+      manager()->OnMediaDataChange(
+          GetPlayerId(), video_format_, gst_height_, gst_width_, media_type);
+    }
+  }
+
   base::TimeDelta timestamp =
       base::TimeDelta::FromMicroseconds(
           GST_BUFFER_TIMESTAMP(buffer) /