diff options
author | Francois Gouget <fgouget@codeweavers.com> | 2016-08-11 12:22:24 +0200 |
---|---|---|
committer | Victor Toso <victortoso@redhat.com> | 2016-08-12 14:41:25 +0200 |
commit | 2674ec79457b641c60b6a352585bee354e360b98 (patch) | |
tree | 6d232ed1913d9d53e946c50ccb0a5b7b9c7ce601 | |
parent | dbaa3238eebf9b7bc0ec59fcf2df856d28e6a5e1 (diff) |
streaming: Create the pipeline at the same time as the GStreamer decoder
This lets create_gstreamer_decoder() fail if it cannot create the
pipeline it needs, allowing the caller to try fallbacks.
This also means the pipeline has the same lifetime as the decoder which
makes it possible to remove a check in queue_frame().
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r-- | src/channel-display-gst.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c index c752639..430bb95 100644 --- a/src/channel-display-gst.c +++ b/src/channel-display-gst.c @@ -407,11 +407,6 @@ static void spice_gst_decoder_queue_frame(VideoDecoder *video_decoder, return; } - if (!decoder->pipeline && !create_pipeline(decoder)) { - stream_dropped_frame_on_playback(decoder->base.stream); - return; - } - /* ref() the frame_msg for the buffer */ spice_msg_in_ref(frame_msg); GstBuffer *buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS, @@ -463,6 +458,11 @@ VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream) g_mutex_init(&decoder->queues_mutex); decoder->decoding_queue = g_queue_new(); decoder->display_queue = g_queue_new(); + + if (!create_pipeline(decoder)) { + decoder->base.destroy((VideoDecoder*)decoder); + decoder = NULL; + } } return (VideoDecoder*)decoder; @@ -475,7 +475,7 @@ gboolean gstvideo_has_codec(int codec_type) VideoDecoder *decoder = create_gstreamer_decoder(codec_type, NULL); if (decoder) { - has_codec = create_pipeline((SpiceGstDecoder*)decoder); + has_codec = TRUE; decoder->destroy(decoder); } |