rtp/vp8depay+vp9depay: Enable hdrext aggregation for VP8 and VP9

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4979>
This commit is contained in:
Jochen Henneberg 2023-07-30 10:48:12 +02:00
parent 2673a66e60
commit a97d3acb90
2 changed files with 16 additions and 0 deletions

View file

@ -82,6 +82,9 @@ enum
static void
gst_rtp_vp8_depay_init (GstRtpVP8Depay * self)
{
gst_rtp_base_depayload_set_aggregate_hdrext_enabled (GST_RTP_BASE_DEPAYLOAD
(self), TRUE);
self->adapter = gst_adapter_new ();
self->started = FALSE;
self->wait_for_keyframe = DEFAULT_WAIT_FOR_KEYFRAME;
@ -351,6 +354,8 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
if (frame_start) {
if (G_UNLIKELY (self->started)) {
GST_DEBUG_OBJECT (depay, "Incomplete frame, flushing adapter");
/* keep the current buffer because it may still be used later */
gst_rtp_base_depayload_flush (depay, TRUE);
gst_adapter_clear (self->adapter);
self->started = FALSE;
@ -425,6 +430,7 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DELTA_UNIT);
if (self->waiting_for_keyframe) {
gst_rtp_base_depayload_flush (depay, FALSE);
gst_buffer_unref (out);
out = NULL;
GST_INFO_OBJECT (self, "Dropping inter-frame before intra-frame");
@ -473,10 +479,12 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
}
done:
gst_rtp_base_depayload_dropped (depay);
return NULL;
too_small:
GST_DEBUG_OBJECT (self, "Invalid rtp packet (too small), ignoring");
gst_rtp_base_depayload_flush (depay, FALSE);
gst_adapter_clear (self->adapter);
self->started = FALSE;

View file

@ -83,6 +83,9 @@ enum
static void
gst_rtp_vp9_depay_init (GstRtpVP9Depay * self)
{
gst_rtp_base_depayload_set_aggregate_hdrext_enabled (GST_RTP_BASE_DEPAYLOAD
(self), TRUE);
self->adapter = gst_adapter_new ();
self->started = FALSE;
self->inter_picture = FALSE;
@ -421,6 +424,8 @@ gst_rtp_vp9_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
if (is_start_of_picture) {
if (G_UNLIKELY (self->started)) {
GST_DEBUG_OBJECT (depay, "Incomplete frame, flushing adapter");
/* keep the current buffer because it may still be used later */
gst_rtp_base_depayload_flush (depay, TRUE);
gst_adapter_clear (self->adapter);
self->started = FALSE;
flushed_adapter = TRUE;
@ -503,6 +508,7 @@ gst_rtp_vp9_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DELTA_UNIT);
if (self->waiting_for_keyframe) {
gst_rtp_base_depayload_flush (depay, FALSE);
gst_buffer_unref (out);
out = NULL;
GST_INFO_OBJECT (self, "Dropping inter-frame before intra-frame");
@ -547,10 +553,12 @@ gst_rtp_vp9_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
}
done:
gst_rtp_base_depayload_dropped (depay);
return NULL;
too_small:
GST_LOG_OBJECT (self, "Invalid rtp packet (too small), ignoring");
gst_rtp_base_depayload_flush (depay, FALSE);
gst_adapter_clear (self->adapter);
self->started = FALSE;
goto done;