[Spice-devel] [PATCH] gst: new_sample: remove redundant sample? condition

Uri Lublin uril at redhat.com
Thu Jul 20 16:41:13 UTC 2017


Move the declaration and assignment of 'buffer' into
the if (sample) block, where sample is not NULL.

Signed-off-by: Uri Lublin <uril at redhat.com>
---
 src/channel-display-gst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 3f51361..03c6044 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -200,8 +200,8 @@ static GstFlowReturn new_sample(GstAppSink *gstappsink, gpointer video_decoder)
     SpiceGstDecoder *decoder = video_decoder;
 
     GstSample *sample = gst_app_sink_pull_sample(decoder->appsink);
-    GstBuffer *buffer = sample ? gst_sample_get_buffer(sample) : NULL;
     if (sample) {
+        GstBuffer *buffer = gst_sample_get_buffer(sample);
         g_mutex_lock(&decoder->queues_mutex);
 
         /* gst_app_sink_pull_sample() sometimes returns the same buffer twice
-- 
2.13.3



More information about the Spice-devel mailing list