From 844423ff99e281fc831303b92861ed43ce5c1518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= Date: Sat, 20 May 2017 16:55:40 +0000 Subject: [PATCH] qtdemux: also push buffers without encryption info instead of dropping them Test "17. PlayReadyH264Video" in YouTube leanback EME conformance tests 2016 for H.264[1] uses a media file[2] with cenc encryption whose first two 'moof' boxes have no encryption information (no 'saiz' and 'saio' boxes). Those boxes are actually not encrypted and the current qtdemux implementation was just dropping them, breaking the test use case. This patch detects those kind of situations and just lets the unencrypted buffers pass. Of course, this needs some collaboration by the decryptors, which should also do the same and not to try to decrypt those clear buffers. [1] http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2016.html?test_type=encryptedmedia-test&webm=false [2] http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/media/oops_cenc-20121114-142.mp4 https://bugzilla.gnome.org/show_bug.cgi?id=770107 --- gst/isomp4/qtdemux.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 4a99ca5ede..1c323b3c8d 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -5783,25 +5783,25 @@ gst_qtdemux_decorate_and_push_buffer (GstQTDemux * qtdemux, } if (info->crypto_info == NULL) { - GST_DEBUG_OBJECT (qtdemux, "cenc metadata hasn't been parsed yet"); - gst_buffer_unref (buf); - goto exit; - } - - /* The end of the crypto_info array matches our n_samples position, - * so count backward from there */ - index = stream->sample_index - stream->n_samples + info->crypto_info->len; - if (G_LIKELY (index >= 0 && index < info->crypto_info->len)) { - /* steal structure from array */ - crypto_info = g_ptr_array_index (info->crypto_info, index); - g_ptr_array_index (info->crypto_info, index) = NULL; - GST_LOG_OBJECT (qtdemux, "attaching cenc metadata [%u/%u]", index, - info->crypto_info->len); - if (!crypto_info || !gst_buffer_add_protection_meta (buf, crypto_info)) - GST_ERROR_OBJECT (qtdemux, "failed to attach cenc metadata to buffer"); + GST_DEBUG_OBJECT (qtdemux, + "cenc metadata hasn't been parsed yet, pushing buffer as if it wasn't encrypted"); } else { - GST_INFO_OBJECT (qtdemux, "No crypto info with index %d and sample %d", - index, stream->sample_index); + /* The end of the crypto_info array matches our n_samples position, + * so count backward from there */ + index = stream->sample_index - stream->n_samples + info->crypto_info->len; + if (G_LIKELY (index >= 0 && index < info->crypto_info->len)) { + /* steal structure from array */ + crypto_info = g_ptr_array_index (info->crypto_info, index); + g_ptr_array_index (info->crypto_info, index) = NULL; + GST_LOG_OBJECT (qtdemux, "attaching cenc metadata [%u/%u]", index, + info->crypto_info->len); + if (!crypto_info || !gst_buffer_add_protection_meta (buf, crypto_info)) + GST_ERROR_OBJECT (qtdemux, + "failed to attach cenc metadata to buffer"); + } else { + GST_INFO_OBJECT (qtdemux, "No crypto info with index %d and sample %d", + index, stream->sample_index); + } } }