mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
webrtcbin: improve some debugging output
- Put human readable names into debug strings. - Demote some frequent rtpbin signal logging - Don't use GST_PTR_FORMAT in g_set_error() Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1664>
This commit is contained in:
parent
c02c8a85ce
commit
cda81bdb1e
3 changed files with 51 additions and 28 deletions
|
@ -2218,6 +2218,7 @@ _create_webrtc_transceiver (GstWebRTCBin * webrtc,
|
||||||
GstWebRTCRTPTransceiverDirection direction, guint mline, GstWebRTCKind kind,
|
GstWebRTCRTPTransceiverDirection direction, guint mline, GstWebRTCKind kind,
|
||||||
GstCaps * codec_preferences)
|
GstCaps * codec_preferences)
|
||||||
{
|
{
|
||||||
|
char *dir_str = gst_webrtc_rtp_transceiver_direction_to_string (direction);
|
||||||
WebRTCTransceiver *trans;
|
WebRTCTransceiver *trans;
|
||||||
GstWebRTCRTPTransceiver *rtp_trans;
|
GstWebRTCRTPTransceiver *rtp_trans;
|
||||||
GstWebRTCRTPSender *sender;
|
GstWebRTCRTPSender *sender;
|
||||||
|
@ -2235,6 +2236,10 @@ _create_webrtc_transceiver (GstWebRTCBin * webrtc,
|
||||||
/* FIXME: We don't support stopping transceiver yet so they're always not stopped */
|
/* FIXME: We don't support stopping transceiver yet so they're always not stopped */
|
||||||
rtp_trans->stopped = FALSE;
|
rtp_trans->stopped = FALSE;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (webrtc, "created new transceiver %" GST_PTR_FORMAT " with "
|
||||||
|
"direction %s (%d), mline %u, kind %s (%d)", rtp_trans, dir_str,
|
||||||
|
direction, mline, gst_webrtc_kind_to_string (kind), kind);
|
||||||
|
|
||||||
g_signal_connect_object (sender, "notify::priority",
|
g_signal_connect_object (sender, "notify::priority",
|
||||||
G_CALLBACK (gst_webrtc_bin_attach_tos), webrtc, G_CONNECT_SWAPPED);
|
G_CALLBACK (gst_webrtc_bin_attach_tos), webrtc, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
@ -2246,6 +2251,8 @@ _create_webrtc_transceiver (GstWebRTCBin * webrtc,
|
||||||
g_signal_emit (webrtc, gst_webrtc_bin_signals[ON_NEW_TRANSCEIVER_SIGNAL],
|
g_signal_emit (webrtc, gst_webrtc_bin_signals[ON_NEW_TRANSCEIVER_SIGNAL],
|
||||||
0, trans);
|
0, trans);
|
||||||
|
|
||||||
|
g_free (dir_str);
|
||||||
|
|
||||||
return trans;
|
return trans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3474,10 +3481,9 @@ _create_offer_task (GstWebRTCBin * webrtc, const GstStructure * options,
|
||||||
if (wtrans->mline_locked && trans->mline != media_idx) {
|
if (wtrans->mline_locked && trans->mline != media_idx) {
|
||||||
g_set_error (error, GST_WEBRTC_ERROR,
|
g_set_error (error, GST_WEBRTC_ERROR,
|
||||||
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
||||||
"Previous negotiatied transceiver %"
|
"Previous negotiatied transceiver <%s> with mid %s was in "
|
||||||
GST_PTR_FORMAT " with mid %s was in mline %d but transceiver"
|
"mline %d but transceiver has locked mline %u",
|
||||||
" has locked mline %u", trans, trans->mid, media_idx,
|
GST_OBJECT_NAME (trans), trans->mid, media_idx, trans->mline);
|
||||||
trans->mline);
|
|
||||||
goto cancel_offer;
|
goto cancel_offer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3626,8 +3632,8 @@ _create_offer_task (GstWebRTCBin * webrtc, const GstStructure * options,
|
||||||
|
|
||||||
g_set_error (error, GST_WEBRTC_ERROR,
|
g_set_error (error, GST_WEBRTC_ERROR,
|
||||||
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
||||||
"Tranceiver %" GST_PTR_FORMAT " with mid %s has locked mline %d"
|
"Tranceiver <%s> with mid %s has locked mline %d but the offer "
|
||||||
" but the whole offer only has %u sections", trans, trans->mid,
|
"only has %u sections", GST_OBJECT_NAME (trans), trans->mid,
|
||||||
trans->mline, media_idx);
|
trans->mline, media_idx);
|
||||||
goto cancel_offer;
|
goto cancel_offer;
|
||||||
}
|
}
|
||||||
|
@ -4179,11 +4185,15 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options,
|
||||||
goto rejected;
|
goto rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_update_transceiver_kind_from_caps (rtp_trans, answer_caps))
|
if (!_update_transceiver_kind_from_caps (rtp_trans, answer_caps)) {
|
||||||
|
GstWebRTCKind caps_kind = webrtc_kind_from_caps (answer_caps);
|
||||||
|
|
||||||
GST_WARNING_OBJECT (webrtc,
|
GST_WARNING_OBJECT (webrtc,
|
||||||
"Trying to change transceiver %d kind from %d to %d",
|
"Trying to change kind of transceiver %" GST_PTR_FORMAT
|
||||||
rtp_trans->mline, rtp_trans->kind,
|
" at m-line %d from %s (%d) to %s (%d)", trans, rtp_trans->mline,
|
||||||
webrtc_kind_from_caps (answer_caps));
|
gst_webrtc_kind_to_string (rtp_trans->kind), rtp_trans->kind,
|
||||||
|
gst_webrtc_kind_to_string (caps_kind), caps_kind);
|
||||||
|
}
|
||||||
|
|
||||||
answer_caps = gst_caps_make_writable (answer_caps);
|
answer_caps = gst_caps_make_writable (answer_caps);
|
||||||
for (k = 0; k < gst_caps_get_size (answer_caps); k++) {
|
for (k = 0; k < gst_caps_get_size (answer_caps); k++) {
|
||||||
|
@ -5042,15 +5052,15 @@ _update_transceiver_from_sdp_media (GstWebRTCBin * webrtc,
|
||||||
|
|
||||||
if (!g_strcmp0 (gst_sdp_media_get_media (media), "audio")) {
|
if (!g_strcmp0 (gst_sdp_media_get_media (media), "audio")) {
|
||||||
if (rtp_trans->kind == GST_WEBRTC_KIND_VIDEO)
|
if (rtp_trans->kind == GST_WEBRTC_KIND_VIDEO)
|
||||||
GST_FIXME_OBJECT (webrtc,
|
GST_FIXME_OBJECT (webrtc, "Updating video transceiver %" GST_PTR_FORMAT
|
||||||
"Updating video transceiver to audio, which isn't fully supported.");
|
" to audio, which isn't fully supported.", rtp_trans);
|
||||||
rtp_trans->kind = GST_WEBRTC_KIND_AUDIO;
|
rtp_trans->kind = GST_WEBRTC_KIND_AUDIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_strcmp0 (gst_sdp_media_get_media (media), "video")) {
|
if (!g_strcmp0 (gst_sdp_media_get_media (media), "video")) {
|
||||||
if (rtp_trans->kind == GST_WEBRTC_KIND_AUDIO)
|
if (rtp_trans->kind == GST_WEBRTC_KIND_AUDIO)
|
||||||
GST_FIXME_OBJECT (webrtc,
|
GST_FIXME_OBJECT (webrtc, "Updating audio transceiver %" GST_PTR_FORMAT
|
||||||
"Updating audio transceiver to video, which isn't fully supported.");
|
" to video, which isn't fully supported.", rtp_trans);
|
||||||
rtp_trans->kind = GST_WEBRTC_KIND_VIDEO;
|
rtp_trans->kind = GST_WEBRTC_KIND_VIDEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5628,19 +5638,25 @@ check_locked_mlines (GstWebRTCBin * webrtc, GstWebRTCSessionDescription * sdp,
|
||||||
if (rtp_trans->kind != GST_WEBRTC_KIND_UNKNOWN) {
|
if (rtp_trans->kind != GST_WEBRTC_KIND_UNKNOWN) {
|
||||||
if (!g_strcmp0 (gst_sdp_media_get_media (media), "audio") &&
|
if (!g_strcmp0 (gst_sdp_media_get_media (media), "audio") &&
|
||||||
rtp_trans->kind != GST_WEBRTC_KIND_AUDIO) {
|
rtp_trans->kind != GST_WEBRTC_KIND_AUDIO) {
|
||||||
|
char *trans_kind = gst_webrtc_kind_to_string (rtp_trans->kind);
|
||||||
g_set_error (error, GST_WEBRTC_ERROR,
|
g_set_error (error, GST_WEBRTC_ERROR,
|
||||||
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
||||||
"m-line %d was locked to audio, but SDP has %s media", i,
|
"m-line %d with transceiver <%s> was locked to %s, but SDP has "
|
||||||
|
"%s media", i, GST_OBJECT_NAME (rtp_trans), trans_kind,
|
||||||
gst_sdp_media_get_media (media));
|
gst_sdp_media_get_media (media));
|
||||||
|
g_free (trans_kind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_strcmp0 (gst_sdp_media_get_media (media), "video") &&
|
if (!g_strcmp0 (gst_sdp_media_get_media (media), "video") &&
|
||||||
rtp_trans->kind != GST_WEBRTC_KIND_VIDEO) {
|
rtp_trans->kind != GST_WEBRTC_KIND_VIDEO) {
|
||||||
|
char *trans_kind = gst_webrtc_kind_to_string (rtp_trans->kind);
|
||||||
g_set_error (error, GST_WEBRTC_ERROR,
|
g_set_error (error, GST_WEBRTC_ERROR,
|
||||||
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
GST_WEBRTC_ERROR_INTERNAL_FAILURE,
|
||||||
"m-line %d was locked to video, but SDP has %s media", i,
|
"m-line %d with transceiver <%s> was locked to %s, but SDP has "
|
||||||
|
"%s media", i, GST_OBJECT_NAME (rtp_trans), trans_kind,
|
||||||
gst_sdp_media_get_media (media));
|
gst_sdp_media_get_media (media));
|
||||||
|
g_free (trans_kind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6659,7 +6675,7 @@ on_rtpbin_request_pt_map (GstElement * rtpbin, guint session_id, guint pt,
|
||||||
if ((ret = transport_stream_get_caps_for_pt (stream, pt)))
|
if ((ret = transport_stream_get_caps_for_pt (stream, pt)))
|
||||||
gst_caps_ref (ret);
|
gst_caps_ref (ret);
|
||||||
|
|
||||||
GST_TRACE_OBJECT (webrtc, "Found caps %" GST_PTR_FORMAT " for pt %d in "
|
GST_DEBUG_OBJECT (webrtc, "Found caps %" GST_PTR_FORMAT " for pt %d in "
|
||||||
"session %d", ret, pt, session_id);
|
"session %d", ret, pt, session_id);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -7234,10 +7250,15 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
||||||
GST_LOG_OBJECT (webrtc, "Using existing transceiver %" GST_PTR_FORMAT
|
GST_LOG_OBJECT (webrtc, "Using existing transceiver %" GST_PTR_FORMAT
|
||||||
" for mline %u", trans, serial);
|
" for mline %u", trans, serial);
|
||||||
if (caps) {
|
if (caps) {
|
||||||
if (!_update_transceiver_kind_from_caps (trans, caps))
|
if (!_update_transceiver_kind_from_caps (trans, caps)) {
|
||||||
|
GstWebRTCKind caps_kind = webrtc_kind_from_caps (caps);
|
||||||
|
|
||||||
GST_WARNING_OBJECT (webrtc,
|
GST_WARNING_OBJECT (webrtc,
|
||||||
"Trying to change transceiver %d kind from %d to %d",
|
"Trying to change kind of transceiver %" GST_PTR_FORMAT
|
||||||
serial, trans->kind, webrtc_kind_from_caps (caps));
|
" at m-line %d from %s (%d) to %s (%d)", trans, serial,
|
||||||
|
gst_webrtc_kind_to_string (trans->kind), trans->kind,
|
||||||
|
gst_webrtc_kind_to_string (caps_kind), caps_kind);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pad = _create_pad_for_sdp_media (webrtc, GST_PAD_SINK, trans, serial);
|
pad = _create_pad_for_sdp_media (webrtc, GST_PAD_SINK, trans, serial);
|
||||||
|
|
|
@ -67,6 +67,9 @@ GstCaps * _rtp_caps_from_media (const GstSDPMedia * media);
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GstWebRTCKind webrtc_kind_from_caps (const GstCaps * caps);
|
GstWebRTCKind webrtc_kind_from_caps (const GstCaps * caps);
|
||||||
|
|
||||||
|
#define gst_webrtc_kind_to_string(kind) _enum_value_to_string(GST_TYPE_WEBRTC_KIND, kind)
|
||||||
|
#define gst_webrtc_rtp_transceiver_direction_to_string(dir) _enum_value_to_string(GST_TYPE_WEBRTC_RTP_TRANSCEIVER_DIRECTION, dir)
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __WEBRTC_UTILS_H__ */
|
#endif /* __WEBRTC_UTILS_H__ */
|
||||||
|
|
|
@ -3912,9 +3912,8 @@ GST_START_TEST (test_reject_create_offer)
|
||||||
gst_structure_get (s, "error", G_TYPE_ERROR, &error, NULL);
|
gst_structure_get (s, "error", G_TYPE_ERROR, &error, NULL);
|
||||||
fail_unless (g_error_matches (error, GST_WEBRTC_ERROR,
|
fail_unless (g_error_matches (error, GST_WEBRTC_ERROR,
|
||||||
GST_WEBRTC_ERROR_INTERNAL_FAILURE));
|
GST_WEBRTC_ERROR_INTERNAL_FAILURE));
|
||||||
fail_unless (g_str_match_string
|
fail_unless_equals_string (error->message,
|
||||||
("has locked mline 1 but the whole offer only has 0 sections",
|
"Tranceiver <webrtctransceiver0> with mid (null) has locked mline 1 but the offer only has 0 sections");
|
||||||
error->message, FALSE));
|
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
gst_promise_unref (promise);
|
gst_promise_unref (promise);
|
||||||
|
|
||||||
|
@ -3986,9 +3985,9 @@ GST_START_TEST (test_reject_set_description)
|
||||||
gst_structure_get (s, "error", G_TYPE_ERROR, &error, NULL);
|
gst_structure_get (s, "error", G_TYPE_ERROR, &error, NULL);
|
||||||
fail_unless (g_error_matches (error, GST_WEBRTC_ERROR,
|
fail_unless (g_error_matches (error, GST_WEBRTC_ERROR,
|
||||||
GST_WEBRTC_ERROR_INTERNAL_FAILURE));
|
GST_WEBRTC_ERROR_INTERNAL_FAILURE));
|
||||||
fail_unless (g_str_match_string
|
fail_unless_equals_string
|
||||||
("m-line 0 was locked to audio, but SDP has audio media", error->message,
|
(error->message,
|
||||||
FALSE));
|
"m-line 0 with transceiver <webrtctransceiver1> was locked to video, but SDP has audio media");
|
||||||
|
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
fail_unless (s != NULL);
|
fail_unless (s != NULL);
|
||||||
|
@ -4186,9 +4185,9 @@ GST_START_TEST (test_codec_preferences_negotiation_sinkpad)
|
||||||
gst_structure_get (s, "error", G_TYPE_ERROR, &error, NULL);
|
gst_structure_get (s, "error", G_TYPE_ERROR, &error, NULL);
|
||||||
fail_unless (g_error_matches (error, GST_WEBRTC_ERROR,
|
fail_unless (g_error_matches (error, GST_WEBRTC_ERROR,
|
||||||
GST_WEBRTC_ERROR_INTERNAL_FAILURE));
|
GST_WEBRTC_ERROR_INTERNAL_FAILURE));
|
||||||
fail_unless (g_str_match_string
|
fail_unless_equals_string
|
||||||
("Caps negotiation on pad sink_0 failed against codec preferences",
|
("Caps negotiation on pad sink_0 failed against codec preferences",
|
||||||
error->message, FALSE));
|
error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
gst_promise_unref (promise);
|
gst_promise_unref (promise);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue