mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
applemedia: vtdec: minor texture cache fixes
Small fix on how the texture cache is cleaned up / setup in case of renegotiation
This commit is contained in:
parent
3c681045bf
commit
94cd5316f3
1 changed files with 21 additions and 11 deletions
|
@ -237,13 +237,13 @@ static void
|
||||||
setup_texture_cache (GstVtdec * vtdec, GstGLContext * context)
|
setup_texture_cache (GstVtdec * vtdec, GstGLContext * context)
|
||||||
{
|
{
|
||||||
GstVideoFormat internal_format;
|
GstVideoFormat internal_format;
|
||||||
GstVideoCodecState *output_state =
|
GstVideoCodecState *output_state;
|
||||||
gst_video_decoder_get_output_state (GST_VIDEO_DECODER (vtdec));
|
|
||||||
|
|
||||||
GST_INFO_OBJECT (vtdec, "pushing textures. GL context %p", context);
|
g_return_if_fail (vtdec->texture_cache == NULL);
|
||||||
if (vtdec->texture_cache)
|
|
||||||
gst_core_video_texture_cache_free (vtdec->texture_cache);
|
|
||||||
|
|
||||||
|
GST_INFO_OBJECT (vtdec, "Setting up texture cache. GL context %p", context);
|
||||||
|
|
||||||
|
output_state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (vtdec));
|
||||||
#ifdef HAVE_IOS
|
#ifdef HAVE_IOS
|
||||||
internal_format = GST_VIDEO_FORMAT_NV12;
|
internal_format = GST_VIDEO_FORMAT_NV12;
|
||||||
#else
|
#else
|
||||||
|
@ -294,26 +294,36 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder)
|
||||||
vtdec->input_state);
|
vtdec->input_state);
|
||||||
output_state->caps = gst_video_info_to_caps (&output_state->info);
|
output_state->caps = gst_video_info_to_caps (&output_state->info);
|
||||||
if (output_state->info.finfo->format == GST_VIDEO_FORMAT_RGBA) {
|
if (output_state->info.finfo->format == GST_VIDEO_FORMAT_RGBA) {
|
||||||
setup_texture_cache (vtdec, context);
|
|
||||||
gst_caps_set_features (output_state->caps, 0,
|
gst_caps_set_features (output_state->caps, 0,
|
||||||
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
|
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
|
||||||
}
|
}
|
||||||
if (context)
|
|
||||||
gst_object_unref (context);
|
|
||||||
|
|
||||||
GST_INFO_OBJECT (vtdec, "negotiated output format %" GST_PTR_FORMAT,
|
|
||||||
output_state->caps);
|
|
||||||
|
|
||||||
prevcaps = gst_pad_get_current_caps (decoder->srcpad);
|
prevcaps = gst_pad_get_current_caps (decoder->srcpad);
|
||||||
if (!prevcaps || !gst_caps_is_equal (prevcaps, output_state->caps)) {
|
if (!prevcaps || !gst_caps_is_equal (prevcaps, output_state->caps)) {
|
||||||
|
GST_INFO_OBJECT (vtdec, "negotiated output format %" GST_PTR_FORMAT,
|
||||||
|
output_state->caps);
|
||||||
|
|
||||||
if (vtdec->session) {
|
if (vtdec->session) {
|
||||||
gst_vtdec_push_frames_if_needed (vtdec, TRUE, FALSE);
|
gst_vtdec_push_frames_if_needed (vtdec, TRUE, FALSE);
|
||||||
gst_vtdec_invalidate_session (vtdec);
|
gst_vtdec_invalidate_session (vtdec);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_vtdec_create_session (vtdec, format);
|
ret = gst_vtdec_create_session (vtdec, format);
|
||||||
|
if (ret) {
|
||||||
|
if (vtdec->texture_cache) {
|
||||||
|
gst_core_video_texture_cache_free (vtdec->texture_cache);
|
||||||
|
vtdec->texture_cache = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output_state->info.finfo->format == GST_VIDEO_FORMAT_RGBA)
|
||||||
|
setup_texture_cache (vtdec, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (prevcaps)
|
if (prevcaps)
|
||||||
gst_caps_unref (prevcaps);
|
gst_caps_unref (prevcaps);
|
||||||
|
if (context)
|
||||||
|
gst_object_unref (context);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue