Re: [spice-gtk v1 2/6] display-gst: rely on SpiceSession init of GStreamer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,


On 9/2/19 7:04 PM, Victor Toso wrote:
From: Victor Toso <me@xxxxxxxxxxxxxx>

This means we can drop gstvideo_init() function and replace its calls
with gst_is_initialized().

Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
---
  src/channel-display-gst.c | 23 +++++------------------
  1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 6fccf62..a34b5d0 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -748,22 +748,6 @@ static gboolean spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
      return TRUE;
  }
-static gboolean gstvideo_init(void)
-{
-    static int success = 0;
-    if (!success) {
-        GError *err = NULL;
-        if (gst_init_check(NULL, NULL, &err)) {
-            success = 1;
-        } else {
-            spice_warning("Disabling GStreamer video support: %s", err->message);
-            g_clear_error(&err);
-            success = -1;
-        }
-    }
-    return success > 0;
-}
-
  G_GNUC_INTERNAL
  VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream)
  {
@@ -771,7 +755,7 @@ VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream)
g_return_val_if_fail(VALID_VIDEO_CODEC_TYPE(codec_type), NULL); - if (gstvideo_init()) {
+    if (gst_is_initialized()) {

Since the logical thing to do is usually to initialize gstreamer
once you start using it i would add a comment it's now initialized
by the session (if not externally)

(also on gstaudio)

Snir.

          decoder = g_new0(SpiceGstDecoder, 1);
          decoder->base.destroy = spice_gst_decoder_destroy;
          decoder->base.reschedule = spice_gst_decoder_reschedule;
@@ -820,7 +804,10 @@ gboolean gstvideo_has_codec(int codec_type)
      GstCaps *caps;
      GstElementFactoryListType type;
- g_return_val_if_fail(gstvideo_init(), FALSE);
+    if (!gst_is_initialized()) {
+        return FALSE;
+    }
+
      g_return_val_if_fail(VALID_VIDEO_CODEC_TYPE(codec_type), FALSE);
type = GST_ELEMENT_FACTORY_TYPE_DECODER |
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]