From 9cd880ac579a0ddb657148e353dbd86db1fd9709 Mon Sep 17 00:00:00 2001 From: Alexander Slobodeniuk Date: Thu, 10 Oct 2024 01:08:58 +0200 Subject: [PATCH 1/3] webcodecsvideodec: fix logging of the output frame timestamps Issue: RDI_2082 --- .../gst/web/codecs/gstwebcodecsvideodecoder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst.wasm/subprojects/gst-plugins-web/gst/web/codecs/gstwebcodecsvideodecoder.cpp b/gst.wasm/subprojects/gst-plugins-web/gst/web/codecs/gstwebcodecsvideodecoder.cpp index e6e5fed..71ead18 100644 --- a/gst.wasm/subprojects/gst-plugins-web/gst/web/codecs/gstwebcodecsvideodecoder.cpp +++ b/gst.wasm/subprojects/gst-plugins-web/gst/web/codecs/gstwebcodecsvideodecoder.cpp @@ -173,8 +173,8 @@ gst_web_codecs_video_decoder_on_output (val video_frame) frame = gst_video_decoder_get_oldest_frame (GST_VIDEO_DECODER (self)); GST_DEBUG_OBJECT (self, "queued frame %" GST_TIME_FORMAT " decoded frame %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_TIME_AS_MSECONDS (frame->pts)), - GST_TIME_ARGS (video_frame["timestamp"].as ())); + GST_TIME_ARGS (frame->pts), + GST_TIME_ARGS (GST_MSECOND * video_frame["timestamp"].as ())); /* Configure the output */ if (!self->output_state) { From 6b24aa38029fb82b351479c661e669bbbfe6dffa Mon Sep 17 00:00:00 2001 From: Alexander Slobodeniuk Date: Thu, 10 Oct 2024 01:58:02 +0200 Subject: [PATCH 2/3] webcanvassink: fix logging Issue: RDI_2082 --- .../gst-plugins-web/gst/web/gstwebcanvassink.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebcanvassink.cpp b/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebcanvassink.cpp index 93c1a10..10c5360 100644 --- a/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebcanvassink.cpp +++ b/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebcanvassink.cpp @@ -102,6 +102,9 @@ enum PROP_LAST }; +#define GST_CAT_DEFAULT gst_web_canvas_sink_debug_category +GST_DEBUG_CATEGORY_STATIC (gst_web_canvas_sink_debug_category); + #define gst_web_canvas_sink_parent_class parent_class G_DEFINE_TYPE (GstWebCanvasSink, gst_web_canvas_sink, GST_TYPE_VIDEO_SINK); @@ -167,7 +170,6 @@ gst_web_canvas_sink_setup (gpointer data) { GstWebCanvasSinkSetupData *setup_data = (GstWebCanvasSinkSetupData *) data; GstWebCanvasSink *self = setup_data->self; - GstVideoSink *sink = GST_VIDEO_SINK (self); /* FIXME how to handle the case of multiple canvases? */ self->val_canvas = val::module_property ("canvas"); @@ -185,6 +187,9 @@ gst_web_canvas_sink_show_frame (GstVideoSink *sink, GstBuffer *buf) GstCapsFeatures *features; GstCaps *caps; + GST_DEBUG_OBJECT (self, "show frame, pts = %" GST_TIME_FORMAT, + GST_TIME_ARGS (GST_BUFFER_PTS (buf))); + /* Check the format */ caps = gst_pad_get_current_caps (GST_BASE_SINK (sink)->sinkpad); features = gst_caps_get_features (caps, 0); @@ -203,6 +208,8 @@ gst_web_canvas_sink_show_frame (GstVideoSink *sink, GstBuffer *buf) gst_web_runner_send_message (runner, cb, &data); gst_object_unref (GST_OBJECT (runner)); + GST_DEBUG_OBJECT (self, "show frame done, pts = %" GST_TIME_FORMAT, + GST_TIME_ARGS (GST_BUFFER_PTS (buf))); return GST_FLOW_OK; } @@ -360,4 +367,7 @@ gst_web_canvas_sink_class_init (GstWebCanvasSinkClass *klass) videosink_class->set_info = gst_web_canvas_sink_set_info; gobject_class->finalize = gst_web_canvas_sink_finalize; + + GST_DEBUG_CATEGORY_INIT (gst_web_canvas_sink_debug_category, "webcanvassink", + 0, "Web Canvas Sink"); } From 6dcd7971a839687bb7115efee08bf17bdb61b89e Mon Sep 17 00:00:00 2001 From: Alexander Slobodeniuk Date: Thu, 10 Oct 2024 10:30:43 +0200 Subject: [PATCH 3/3] webfetchsrc: fix structure name Issue: RDI_2082 --- .../gst-plugins-web/gst/web/gstwebfetchsrc.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebfetchsrc.c b/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebfetchsrc.c index f1dea1e..d2a2462 100644 --- a/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebfetchsrc.c +++ b/gst.wasm/subprojects/gst-plugins-web/gst/web/gstwebfetchsrc.c @@ -48,7 +48,7 @@ enum PROP_MAX }; -typedef struct _WebFetchSrc +typedef struct _GstWebFetchSrc { GstPushSrc element; @@ -57,11 +57,11 @@ typedef struct _WebFetchSrc gsize download_offset; gsize download_end; gsize resource_size; -} WebFetchSrc; +} GstWebFetchSrc; G_DECLARE_FINAL_TYPE ( - WebFetchSrc, gst_web_fetch_src, GST, WEB_FETCH_SRC, GstPushSrc) -G_DEFINE_TYPE_WITH_CODE (WebFetchSrc, gst_web_fetch_src, GST_TYPE_PUSH_SRC, + GstWebFetchSrc, gst_web_fetch_src, GST, WEB_FETCH_SRC, GstPushSrc) +G_DEFINE_TYPE_WITH_CODE (GstWebFetchSrc, gst_web_fetch_src, GST_TYPE_PUSH_SRC, G_IMPLEMENT_INTERFACE ( GST_TYPE_URI_HANDLER, gst_web_fetch_src_uri_handler_init)); GST_ELEMENT_REGISTER_DEFINE ( @@ -86,7 +86,7 @@ static gboolean gst_web_fetch_src_urihandler_set_uri ( GstURIHandler *handler, const gchar *uri, GError **error) { - WebFetchSrc *self = GST_WEB_FETCH_SRC (handler); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (handler); g_return_val_if_fail (GST_IS_URI_HANDLER (handler), FALSE); g_return_val_if_fail (uri != NULL, FALSE); @@ -109,7 +109,7 @@ static gchar * gst_web_fetch_src_urihandler_get_uri (GstURIHandler *handler) { gchar *ret; - WebFetchSrc *self; + GstWebFetchSrc *self; g_return_val_if_fail (GST_IS_URI_HANDLER (handler), NULL); self = GST_WEB_FETCH_SRC (handler); @@ -133,13 +133,13 @@ gst_web_fetch_src_uri_handler_init (gpointer g_iface, gpointer iface_data) } static void -gst_web_fetch_src_init (WebFetchSrc *src) +gst_web_fetch_src_init (GstWebFetchSrc *src) { } static gsize gst_web_fetch_src_parse_content_size_field ( - WebFetchSrc *self, emscripten_fetch_t *fetch) + GstWebFetchSrc *self, emscripten_fetch_t *fetch) { gsize length, ret = 0; @@ -188,7 +188,7 @@ gst_web_fetch_src_parse_content_size_field ( /* Called with the GST_OBJECT_LOCK taken */ static GstBuffer * gst_web_fetch_src_fetch_range ( - WebFetchSrc *self, gchar *uri, gsize range_start, gsize range_end) + GstWebFetchSrc *self, gchar *uri, gsize range_start, gsize range_end) { gchar range_field[256]; gchar *headers[] = { "Range", range_field, NULL }; @@ -302,7 +302,7 @@ gst_web_fetch_src_fetch_range ( static GstFlowReturn gst_web_fetch_src_create (GstPushSrc *psrc, GstBuffer **outbuf) { - WebFetchSrc *self = GST_WEB_FETCH_SRC (psrc); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (psrc); GstFlowReturn ret = GST_FLOW_OK; gchar *uri; @@ -337,7 +337,7 @@ static GstStateChangeReturn gst_web_fetch_src_change_state (GstElement *element, GstStateChange transition) { GstStateChangeReturn ret; - WebFetchSrc *self = GST_WEB_FETCH_SRC (element); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (element); switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: @@ -372,7 +372,7 @@ gst_web_fetch_src_change_state (GstElement *element, GstStateChange transition) static gboolean gst_web_fetch_src_get_size (GstBaseSrc *bsrc, guint64 *size) { - WebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc); gboolean ret = FALSE; GST_OBJECT_LOCK (self); @@ -397,7 +397,7 @@ gst_web_fetch_src_is_seekable (GstBaseSrc *bsrc) static gboolean gst_web_fetch_src_do_seek (GstBaseSrc *bsrc, GstSegment *segment) { - WebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (bsrc); g_return_val_if_fail (gst_web_fetch_src_is_seekable (bsrc), FALSE); g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (segment->start), FALSE); @@ -420,7 +420,7 @@ static void gst_web_fetch_src_set_property ( GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - WebFetchSrc *self = GST_WEB_FETCH_SRC (object); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (object); switch (prop_id) { case PROP_LOCATION: @@ -437,7 +437,7 @@ static void gst_web_fetch_src_get_property ( GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - WebFetchSrc *self = GST_WEB_FETCH_SRC (object); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (object); switch (prop_id) { case PROP_LOCATION: @@ -453,7 +453,7 @@ gst_web_fetch_src_get_property ( static void gst_web_fetch_src_finalize (GObject *obj) { - WebFetchSrc *self = GST_WEB_FETCH_SRC (obj); + GstWebFetchSrc *self = GST_WEB_FETCH_SRC (obj); g_free (self->uri); @@ -461,7 +461,7 @@ gst_web_fetch_src_finalize (GObject *obj) } static void -gst_web_fetch_src_class_init (WebFetchSrcClass *klass) +gst_web_fetch_src_class_init (GstWebFetchSrcClass *klass) { static GstStaticPadTemplate srcpadtemplate = GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);