mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
msdkdec: Fix decoding cases with resolution change (VP9)
The resolution of VP9 video can be changed without keyframe. The change detected by MSDK/VPL should be negotiated with downstream. Only the situation can be fixed here if the changed resolution is less than or equal to the initial surface resolution. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4450>
This commit is contained in:
parent
10d2e8c545
commit
a2e83a019a
1 changed files with 19 additions and 0 deletions
|
@ -917,6 +917,25 @@ gst_msdkdec_finish_task (GstMsdkDec * thiz, MsdkDecTask * task)
|
|||
GST_DEBUG_OBJECT (thiz, "Decoded MFX TimeStamp: %" G_GUINT64_FORMAT,
|
||||
(guint64) surface->surface->Data.TimeStamp);
|
||||
pts = surface->surface->Data.TimeStamp;
|
||||
|
||||
if (thiz->param.mfx.CodecId == MFX_CODEC_VP9) {
|
||||
GstVideoCodecState *output_state =
|
||||
gst_video_decoder_get_output_state (GST_VIDEO_DECODER (thiz));
|
||||
/* detect whether the resolution change and negotiate with downstream if so */
|
||||
if ((surface->surface->Info.CropW && surface->surface->Info.CropH)
|
||||
&& ((output_state->info.width != surface->surface->Info.CropW)
|
||||
|| (output_state->info.height != surface->surface->Info.CropH))) {
|
||||
output_state->info.width = surface->surface->Info.CropW;
|
||||
output_state->info.height = surface->surface->Info.CropH;
|
||||
output_state->caps = gst_video_info_to_caps (&output_state->info);
|
||||
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (thiz))) {
|
||||
GST_ERROR_OBJECT (thiz, "Failed to negotiate");
|
||||
gst_video_codec_state_unref (output_state);
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
}
|
||||
gst_video_codec_state_unref (output_state);
|
||||
}
|
||||
}
|
||||
|
||||
if (G_LIKELY (task->sync_point || (surface && task->decode_only))) {
|
||||
|
|
Loading…
Reference in a new issue