applemedia/vtdec: fix negotiation errors when resizing glimagesink

GstVideoDecoder has its own logic for detecting when to reconfigure
which ultimately calls decide_allocation and results in a new
texture cache that has not been configured from our reconfigure check.

https://bugzilla.gnome.org/show_bug.cgi?id=755156
This commit is contained in:
Matthew Waters 2015-09-17 15:06:31 +10:00
parent 557ca6fda5
commit 3772c8ece6

View file

@ -230,8 +230,23 @@ gst_vtdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
gst_query_unref (query);
if (context) {
GstVideoFormat internal_format;
GstVideoCodecState *output_state =
gst_video_decoder_get_output_state (decoder);
GST_INFO_OBJECT (decoder, "pushing textures. GL context %p", context);
if (vtdec->texture_cache)
gst_core_video_texture_cache_free (vtdec->texture_cache);
#ifdef HAVE_IOS
internal_format = GST_VIDEO_FORMAT_NV12;
#else
internal_format = GST_VIDEO_FORMAT_UYVY;
#endif
vtdec->texture_cache = gst_core_video_texture_cache_new (gl_context);
gst_core_video_texture_cache_set_format (vtdec->texture_cache,
internal_format, output_state->caps);
gst_video_codec_state_unref (output_state);
gst_object_unref (gl_context);
} else {
GST_WARNING_OBJECT (decoder,
@ -767,23 +782,8 @@ gst_vtdec_push_frames_if_needed (GstVtdec * vtdec, gboolean drain,
*/
/* negotiate now so that we know whether we need to use the GL upload meta or
* not */
if (gst_pad_check_reconfigure (decoder->srcpad)) {
if (gst_pad_check_reconfigure (decoder->srcpad))
gst_video_decoder_negotiate (decoder);
if (vtdec->texture_cache) {
GstVideoFormat internal_format;
GstVideoCodecState *output_state =
gst_video_decoder_get_output_state (decoder);
#ifdef HAVE_IOS
internal_format = GST_VIDEO_FORMAT_NV12;
#else
internal_format = GST_VIDEO_FORMAT_UYVY;
#endif
gst_core_video_texture_cache_set_format (vtdec->texture_cache,
internal_format, output_state->caps);
gst_video_codec_state_unref (output_state);
}
}
if (drain)
VTDecompressionSessionWaitForAsynchronousFrames (vtdec->session);