[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [phonon-gstreamer/1.0-porting-for-merge] gstreamer: Fix error message from gst_video_info_from_caps 
From:       Dan_Vrátil <dvratil () redhat ! com>
Date:       2014-08-12 14:39:07
Message-ID: E1XHDEB-00073J-QT () scm ! kde ! org
[Download RAW message or body]

Git commit 354daed3fc7cc276f781ce817a559d449638f0cb by Dan Vrátil.
Committed on 12/08/2014 at 10:13.
Pushed by dvratil into branch '1.0-porting-for-merge'.

Fix error message from gst_video_info_from_caps when closing video

When closing video, gst_pad_get_current_caps() returns a NULL caps, which causes
gst_video_info_from_caps() to complain.

This also fixes a memory leak - we were leaking the caps.

M  +8    -4    gstreamer/videowidget.cpp

http://commits.kde.org/phonon-gstreamer/354daed3fc7cc276f781ce817a559d449638f0cb

diff --git a/gstreamer/videowidget.cpp b/gstreamer/videowidget.cpp
index 725e00d..6e3a807 100644
--- a/gstreamer/videowidget.cpp
+++ b/gstreamer/videowidget.cpp
@@ -610,10 +610,14 @@ void VideoWidget::cb_capsChanged(GstPad *pad, GParamSpec *spec, gpointer data)
     //FIXME: This sometimes gives a gstreamer warning. Feels like GStreamer shouldn't, and instead
     //just quietly return false, probably a bug.
     GstVideoInfo info;
-    if (gst_video_info_from_caps(&info, gst_pad_get_current_caps(pad))) {
-        width = info.width;
-        height = info.height;
-        QMetaObject::invokeMethod(that, "setMovieSize", Q_ARG(QSize, QSize(width, height)));
+    GstCaps *caps = gst_pad_get_current_caps(pad);
+    if (caps) {
+        if (gst_video_info_from_caps(&info, caps)) {
+            width = info.width;
+            height = info.height;
+            QMetaObject::invokeMethod(that, "setMovieSize", Q_ARG(QSize, QSize(width, height)));
+        }
+        gst_caps_unref(caps);
     }
 }
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic