After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 788917 - rtspsrc: Handling RTSP messages for debugging
rtspsrc: Handling RTSP messages for debugging
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal minor
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-10-13 08:09 UTC by Sangkyu Park (sangkyup)
Modified: 2017-11-01 09:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rtspsrc: Add 'handle-all-messages' signal (4.02 KB, patch)
2017-10-20 04:49 UTC, Sangkyu Park (sangkyup)
none Details | Review
Add an API for RTSP message log. (7.33 KB, patch)
2017-10-30 07:33 UTC, Sangkyu Park (sangkyup)
none Details | Review
Add debug logs for RTSP messages. (4.42 KB, patch)
2017-10-30 07:35 UTC, Sangkyu Park (sangkyup)
none Details | Review
Replace to print RTSP message from stdout to gstreamer debug log. (5.79 KB, patch)
2017-10-30 10:24 UTC, Sangkyu Park (sangkyup)
none Details | Review
Replace to print RTSP/SDP message from stdout to gstreamer log. (11.58 KB, patch)
2017-10-30 11:01 UTC, Sangkyu Park (sangkyup)
none Details | Review
Replace to print RTSP/SDP message from stdout to gstreamer log. (12.16 KB, text/plain)
2017-10-30 11:13 UTC, Sangkyu Park (sangkyup)
  Details
Replace to print RTSP/SDP message from stdout to gstreamer log. (12.16 KB, patch)
2017-10-30 11:15 UTC, Sangkyu Park (sangkyup)
none Details | Review
fixed build error. (12.17 KB, patch)
2017-10-30 11:18 UTC, Sangkyu Park (sangkyup)
none Details | Review
sorry, updated modification for build error. (12.17 KB, patch)
2017-10-30 11:22 UTC, Sangkyu Park (sangkyup)
none Details | Review
Replace to print RTSP/SDP message from stdout to gstreamer log. (13.58 KB, patch)
2017-10-31 01:24 UTC, Sangkyu Park (sangkyup)
none Details | Review
Replace to print RTSP/SDP message from stdout to gstreamer (13.74 KB, patch)
2017-11-01 02:50 UTC, Sangkyu Park (sangkyup)
none Details | Review
added to check threshold. (13.92 KB, patch)
2017-11-01 09:12 UTC, Sangkyu Park (sangkyup)
committed Details | Review

Description Sangkyu Park (sangkyup) 2017-10-13 08:09:31 UTC
Hello.

I'm an engineer in Tizen TV.
I want to print all RTSP messages using specific log module for debugging.(not std out)
Rtspsrc supports "debug" property to print all RTSP messages. But I can not use it because it supports only std out using g_print.

Is there any way to resolve this ? Please advice to me.
Is it possible that rtspsrc supports bellow?

1. Emitting signal about all RTSP messages like "handle-request" signal.
- If support, Application can access and print all RTSP messages.
Comment 1 Sebastian Dröge (slomo) 2017-10-19 14:27:36 UTC
Ideally these should be printed in the GStreamer debug logs instead, that's a bug in GstRTSPConnection if that doesn't happen.

Do you want to provide a patch?
Comment 2 Sangkyu Park (sangkyup) 2017-10-20 01:01:30 UTC
Yes, I want to provide a patch.

As per your opinion, how about rtspmessage supports to print by the Gstreamer debug log. and rtspsrc supports "print-all-messages" property. If the property is enabled, All RTSP messages are prtined using bellow.

GstRTSPResult
gst_rtsp_message_print (GstRTSPMessage * msg, GstObject * obj)
{
/* print rtsp message by gstreamer debug log instead of g_print */
  GST_DEBUG_OBJECT(obj, "");
}


Please let me know your opinion for this way.
Comment 3 Sangkyu Park (sangkyup) 2017-10-20 01:10:12 UTC
or 

in the other way,
If "debug" property in rtspsrc is enabled, the log is printed additionally like below.

if (src->debug) {
          gst_rtsp_message_dump (&message);
          gst_rtsp_message_print (&message, src);
}

Please give me advice about the ways to resolve.
Thanks.
Comment 4 Sangkyu Park (sangkyup) 2017-10-20 01:11:23 UTC
or 

in the other way,
If "debug" property in rtspsrc is enabled, the log is printed additionally like below.

if (src->debug) {
          gst_rtsp_message_dump (&message);
          gst_rtsp_message_print (&message, src);
}

Please give me advice about the ways to resolve.
Thanks.
Comment 5 Sangkyu Park (sangkyup) 2017-10-20 03:49:30 UTC
I will make a patch below.
Because we need to print all messages by our system log module...
And I think the property is very useful for debugging.

Emitting signal about all RTSP messages like "handle-request" signal.
- If support, Application can access and print all RTSP messages.
Comment 6 Sangkyu Park (sangkyup) 2017-10-20 04:49:21 UTC
Created attachment 361910 [details] [review]
rtspsrc: Add 'handle-all-messages' signal

Please review the patch for emitting signal about all rtsp messages.
Comment 7 Sangkyu Park (sangkyup) 2017-10-27 02:22:42 UTC
Hello Mr. Sebastian Dröge

Please let me know your opinion.
Comment 8 Sebastian Dröge (slomo) 2017-10-27 08:34:46 UTC
It should use the normal GStreamer debugging system instead of printing directly to stdout/stderr, or having yet another special API.
Comment 9 Sangkyu Park (sangkyup) 2017-10-30 07:33:25 UTC
Created attachment 362516 [details] [review]
Add an API for RTSP message log.
Comment 10 Sangkyu Park (sangkyup) 2017-10-30 07:35:19 UTC
Created attachment 362517 [details] [review]
Add debug logs for RTSP messages.
Comment 11 Sangkyu Park (sangkyup) 2017-10-30 07:43:51 UTC
The new patceh use normal gstreamer debugging system.
Please confirm this way is ok or not.

In addtion, the application can change log callback function if rtspsrc supports to set property for log_func.
Comment 12 Sebastian Dröge (slomo) 2017-10-30 07:48:12 UTC
Comment on attachment 362517 [details] [review]
Add debug logs for RTSP messages.

Please make this work without adding additional API, and replace the current printing to stdout/stderr with that. Thanks!
Comment 13 Sangkyu Park (sangkyup) 2017-10-30 08:35:30 UTC
The rtspsrc already print to stdout/stderr using gst_rtsp_message_dump.

Do you mean that replace gst_rtsp_message_dump to gstreamer debug log in rtspsrc ?

Sorry, could you know me more detail?
Comment 14 Sebastian Dröge (slomo) 2017-10-30 09:00:52 UTC
(In reply to Sangkyu Park (sangkyup) from comment #13)
> The rtspsrc already print to stdout/stderr using gst_rtsp_message_dump.

It should not do that and instead use the GStreamer debugging system

> Do you mean that replace gst_rtsp_message_dump to gstreamer debug log in
> rtspsrc ?

Yes
Comment 15 Sangkyu Park (sangkyup) 2017-10-30 10:01:41 UTC
typedef struct _RTSPKeyValue
{
  GstRTSPHeaderField field;
  gchar *value;
  gchar *custom_key;            /* custom header string (field is INVALID then) */
} RTSPKeyValue;

static void
key_value_foreach (GArray * array, GFunc func, gpointer user_data)


The above are static declaration in gstrtspmessage.c.
But they are needed in rtspsrc when printing key values.
Is it possible that changed to global declaration?
Comment 16 Sangkyu Park (sangkyup) 2017-10-30 10:24:34 UTC
Created attachment 362533 [details] [review]
Replace to print RTSP message from stdout to gstreamer debug log.

Please check the way is ok or not..
Printing key values in header is skipped due to static declaration in gstrtspmessage.c.
Comment 17 Sebastian Dröge (slomo) 2017-10-30 10:34:22 UTC
Review of attachment 362533 [details] [review]:

You could copy/modify the code for printing the headers, it's simple enough

::: gst/rtsp/gstrtspsrc.c
@@ +176,1 @@
 #define DEBUG_SDP(__self,msg) if (__self->debug) gst_sdp_message_dump (msg)

Same problem for the SDP
Comment 18 Sangkyu Park (sangkyup) 2017-10-30 10:46:19 UTC
(In reply to Sebastian Dröge (slomo) from comment #17)
> Review of attachment 362533 [details] [review] [review]:
> 
> You could copy/modify the code for printing the headers, it's simple enough

But crash issue will be happend if the static declation for RTSPKeyValue in gstrtspmessage.c is chaneged later.

> 
> ::: gst/rtsp/gstrtspsrc.c
> @@ +176,1 @@
>  #define DEBUG_SDP(__self,msg) if (__self->debug) gst_sdp_message_dump (msg)
> 
> Same problem for the SDP

OK, I will change it now.


How about is log level changed from debug to info ?
Because "debug" property is set to TRUE from user.
Comment 19 Sangkyu Park (sangkyup) 2017-10-30 11:01:37 UTC
Created attachment 362538 [details] [review]
Replace to print RTSP/SDP message from stdout to gstreamer log.
Comment 20 Sangkyu Park (sangkyup) 2017-10-30 11:13:17 UTC
Created attachment 362539 [details]
Replace to print RTSP/SDP message from stdout to gstreamer log.

- Added NULL check.
- Changed descreption for debug property.
Comment 21 Sangkyu Park (sangkyup) 2017-10-30 11:15:34 UTC
Created attachment 362540 [details] [review]
Replace to print RTSP/SDP message from stdout to gstreamer log.

- Added NULL check.
- Changed descreption for debug property.
Comment 22 Sangkyu Park (sangkyup) 2017-10-30 11:18:35 UTC
Created attachment 362541 [details] [review]
fixed build error.
Comment 23 Sangkyu Park (sangkyup) 2017-10-30 11:22:25 UTC
Created attachment 362542 [details] [review]
sorry, updated modification for build error.
Comment 24 Sangkyu Park (sangkyup) 2017-10-31 01:24:18 UTC
Created attachment 362592 [details] [review]
Replace to print RTSP/SDP message from stdout to gstreamer log.

- Add to print RTSP header keys.

This is working fine.
Comment 25 Sebastian Dröge (slomo) 2017-10-31 16:43:09 UTC
Review of attachment 362592 [details] [review]:

Looks mostly good, thanks :)

::: gst/rtsp/gstrtspsrc.c
@@ +470,1 @@
           DEFAULT_DEBUG, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

Let's deprecate this one now and always add it to the log. TRACE or LOG

Check threshold of the category before doing so
Comment 26 Sebastian Dröge (slomo) 2017-10-31 16:45:11 UTC
Review of attachment 362592 [details] [review]:

Looks mostly good, thanks :)

::: gst/rtsp/gstrtspsrc.c
@@ +470,1 @@
           DEFAULT_DEBUG, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

Let's deprecate this one now and always add it to the log. TRACE or LOG

Check threshold of the category before doing so
Comment 27 Sangkyu Park (sangkyup) 2017-11-01 02:50:12 UTC
Created attachment 362710 [details] [review]
Replace to print RTSP/SDP message from stdout to gstreamer

Replace to print RTSP/SDP message from stdout to gstreamer
 log.

- 'debug' property is deprecated
- All RTSP messages are printed to gstreamer log as 'log' level.
Comment 28 Sebastian Dröge (slomo) 2017-11-01 09:03:33 UTC
Comment on attachment 362710 [details] [review]
Replace to print RTSP/SDP message from stdout to gstreamer

Add an early return to these new functions.

> if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) < GST_LEVEL_LOG)
>   return;


We don't want to iterate over everything and create output just to not print it :)
Comment 29 Sangkyu Park (sangkyup) 2017-11-01 09:12:03 UTC
Created attachment 362726 [details] [review]
added to check threshold.
Comment 30 Sangkyu Park (sangkyup) 2017-11-01 09:17:01 UTC
I didn't know to check threshold of category. Thanks for good tip.
Comment 31 Sebastian Dröge (slomo) 2017-11-01 09:36:35 UTC
commit 257f7c906351a115ef7516e23789d615bca7f6b0 (HEAD -> master)
Author: Sangkyu Park <sk1122.park@samsung.com>
Date:   Mon Oct 30 19:15:56 2017 +0900

    rtspsrc: Print RTSP/SDP messages to gstreamer log instead of stdout
    
    - 'debug' property is deprecated
    - All RTSP messages are printed to gstreamer log with 'log' level.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788917