summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Manuel Jaquez Leal <vjaquez@igalia.com>2022-11-28 20:42:29 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2022-12-01 18:54:14 +0000
commit4cbdf43e7d2be8588290bd5859800e9f7a69c643 (patch)
tree8d904ec7800d799e3bdca453bd5fcfff4d6cec8a
parent19b83bc1563e840be85aee3fc50c1d880fca322f (diff)
downloadgstreamer-4cbdf43e7d2be8588290bd5859800e9f7a69c643.tar.gz
va: Handle input caps change.
Update output caps if it's notified by baseclass See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3328 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c2
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvabasedec.c19
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvabasedec.h1
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvah264dec.c3
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvah265dec.c3
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvajpegdec.c2
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c3
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c2
-rw-r--r--subprojects/gst-plugins-bad/sys/va/gstvavp9dec.c2
9 files changed, 29 insertions, 8 deletions
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c b/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c
index 9999df5a10..fc593409c2 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c
@@ -955,7 +955,7 @@ gst_va_av1_dec_output_picture (GstAV1Decoder * decoder,
frame->output_buffer = gst_buffer_ref (pic->gstbuffer);
}
- ret = gst_va_base_dec_process_output (base, frame, 0);
+ ret = gst_va_base_dec_process_output (base, frame, picture->discont_state, 0);
gst_av1_picture_unref (picture);
if (ret)
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c
index 4b168bfe3a..0a1ef5f0f8 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c
@@ -1061,10 +1061,27 @@ fail:
gboolean
gst_va_base_dec_process_output (GstVaBaseDec * base, GstVideoCodecFrame * frame,
- GstVideoBufferFlags buffer_flags)
+ GstVideoCodecState * input_state, GstVideoBufferFlags buffer_flags)
{
GstVideoDecoder *vdec = GST_VIDEO_DECODER (base);
+ if (input_state) {
+
+ g_assert (GST_VIDEO_INFO_WIDTH (&input_state->info) ==
+ GST_VIDEO_INFO_WIDTH (&base->input_state->info)
+ && GST_VIDEO_INFO_HEIGHT (&input_state->info) ==
+ GST_VIDEO_INFO_HEIGHT (&input_state->info));
+
+ g_clear_pointer (&base->input_state, gst_video_codec_state_unref);
+ base->input_state = gst_video_codec_state_ref (input_state);
+
+ base->need_negotiation = TRUE;
+ if (!gst_video_decoder_negotiate (vdec)) {
+ GST_ERROR_OBJECT (base, "Could not re-negotiate with updated state");
+ return GST_FLOW_ERROR;
+ }
+ }
+
if (base->copy_frames)
gst_va_base_dec_copy_output_buffer (base, frame);
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h
index 62b1ae8161..411a7072bf 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h
+++ b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h
@@ -137,6 +137,7 @@ gboolean gst_va_base_dec_copy_output_buffer (GstVaBaseDec * base,
GstVideoCodecFrame * codec_frame);
gboolean gst_va_base_dec_process_output (GstVaBaseDec * base,
GstVideoCodecFrame * frame,
+ GstVideoCodecState * input_state,
GstVideoBufferFlags buffer_flags);
GstFlowReturn gst_va_base_dec_prepare_output_frame (GstVaBaseDec * base,
GstVideoCodecFrame * frame);
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c b/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c
index 53f616f9ad..37cd6918f7 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c
@@ -123,7 +123,8 @@ gst_va_h264_dec_output_picture (GstH264Decoder * decoder,
GST_LOG_OBJECT (self,
"Outputting picture %p (poc %d)", picture, picture->pic_order_cnt);
- ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
+ ret = gst_va_base_dec_process_output (base, frame, picture->discont_state,
+ picture->buffer_flags);
gst_h264_picture_unref (picture);
if (ret)
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c b/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c
index 53be56792c..7f17516bba 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c
@@ -240,7 +240,8 @@ gst_va_h265_dec_output_picture (GstH265Decoder * decoder,
gst_buffer_replace (&frame->output_buffer, va_pic->gstbuffer);
- ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
+ ret = gst_va_base_dec_process_output (base, frame, picture->discont_state,
+ picture->buffer_flags);
gst_h265_picture_unref (picture);
if (ret)
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvajpegdec.c b/subprojects/gst-plugins-bad/sys/va/gstvajpegdec.c
index 4520dcbae1..011220f0a1 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvajpegdec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvajpegdec.c
@@ -322,7 +322,7 @@ gst_va_jpeg_dec_output_picture (GstJpegDecoder * decoder,
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
- if (gst_va_base_dec_process_output (base, frame, 0))
+ if (gst_va_base_dec_process_output (base, frame, NULL, 0))
return gst_video_decoder_finish_frame (vdec, frame);
return GST_FLOW_ERROR;
}
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c b/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c
index ed925ce57c..010c5d0dfd 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c
@@ -518,7 +518,8 @@ gst_va_mpeg2_dec_output_picture (GstMpeg2Decoder * decoder,
GST_LOG_OBJECT (self,
"Outputting picture %p (poc %d)", picture, picture->pic_order_cnt);
- ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
+ ret = gst_va_base_dec_process_output (base, frame, picture->discont_state,
+ picture->buffer_flags);
gst_mpeg2_picture_unref (picture);
if (ret)
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c b/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c
index fe80575209..6f7f930a43 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c
@@ -398,7 +398,7 @@ gst_va_vp8_dec_output_picture (GstVp8Decoder * decoder,
"Outputting picture %p (system_frame_number %d)",
picture, picture->system_frame_number);
- ret = gst_va_base_dec_process_output (base, frame, 0);
+ ret = gst_va_base_dec_process_output (base, frame, picture->discont_state, 0);
gst_vp8_picture_unref (picture);
if (ret)
diff --git a/subprojects/gst-plugins-bad/sys/va/gstvavp9dec.c b/subprojects/gst-plugins-bad/sys/va/gstvavp9dec.c
index f6f18cb206..b35bd66f30 100644
--- a/subprojects/gst-plugins-bad/sys/va/gstvavp9dec.c
+++ b/subprojects/gst-plugins-bad/sys/va/gstvavp9dec.c
@@ -506,7 +506,7 @@ gst_va_vp9_dec_output_picture (GstVp9Decoder * decoder,
GST_LOG_OBJECT (self, "Outputting picture %p", picture);
- ret = gst_va_base_dec_process_output (base, frame, 0);
+ ret = gst_va_base_dec_process_output (base, frame, picture->discont_state, 0);
gst_vp9_picture_unref (picture);
if (ret)