From b47f3c9c5074b99b94c9745f62078eff964a95ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 28 May 2019 14:13:56 +0100 Subject: [PATCH] rtpmp4gdepay: don't spam debug log for broken ADTS-in-RTP AAC Print warning only once. --- gst/rtp/gstrtpmp4gdepay.c | 9 +++++++-- gst/rtp/gstrtpmp4gdepay.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gst/rtp/gstrtpmp4gdepay.c b/gst/rtp/gstrtpmp4gdepay.c index 5d9d2cd..df6c1c3 100644 --- a/gst/rtp/gstrtpmp4gdepay.c +++ b/gst/rtp/gstrtpmp4gdepay.c @@ -241,6 +241,7 @@ gst_rtp_mp4g_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps) "mpegversion", G_TYPE_INT, 4, "stream-format", G_TYPE_STRING, "raw", NULL); rtpmp4gdepay->check_adts = TRUE; + rtpmp4gdepay->warn_adts = TRUE; } else if (strcmp (str, "video") == 0) { srccaps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 4, @@ -681,13 +682,17 @@ gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp) 0xfffe0000, 0xfff00000, 0, 4, &v) == 0) { guint adts_hdr_len = (((v >> 16) & 0x1) == 0) ? 9 : 7; if (avail > adts_hdr_len) { - GST_WARNING_OBJECT (rtpmp4gdepay, "Detected ADTS header of " - "%u bytes, skipping", adts_hdr_len); + if (rtpmp4gdepay->warn_adts) { + GST_WARNING_OBJECT (rtpmp4gdepay, "Detected ADTS header of " + "%u bytes, skipping", adts_hdr_len); + rtpmp4gdepay->warn_adts = FALSE; + } gst_adapter_flush (rtpmp4gdepay->adapter, adts_hdr_len); avail -= adts_hdr_len; } } else { rtpmp4gdepay->check_adts = FALSE; + rtpmp4gdepay->warn_adts = TRUE; } } diff --git a/gst/rtp/gstrtpmp4gdepay.h b/gst/rtp/gstrtpmp4gdepay.h index d4d9330c..8437328 100644 --- a/gst/rtp/gstrtpmp4gdepay.h +++ b/gst/rtp/gstrtpmp4gdepay.h @@ -68,6 +68,7 @@ struct _GstRtpMP4GDepay guint prev_AU_num; gboolean check_adts; /* check for ADTS headers */ + gboolean warn_adts; /* warn about ADTS headers */ GQueue *packets; -- 2.7.4