From b1fac8c781b8e4bab13da931116f25854b1b1494 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Fri, 20 Jun 2014 08:20:55 -0600 Subject: [PATCH] hlsdemux: Fix decrypting fragments Only reset the decryption engine on the first buffer of a fragment, not again for the second buffer. This fixes corrupting the second buffer of a fragment. https://bugzilla.gnome.org/show_bug.cgi?id=731968 --- ext/hls/gsthlsdemux.c | 5 ++++- ext/hls/gsthlsdemux.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 5d39ed03c9..466f665bb6 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -805,7 +805,7 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) gsize available; /* restart the decrypting lib for a new fragment */ - if (demux->starting_fragment) { + if (demux->reset_crypto) { GstFragment *key_fragment; GstBuffer *key_buffer; GstMapInfo key_info; @@ -842,6 +842,8 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) gst_buffer_unmap (key_buffer, &key_info); gst_buffer_unref (key_buffer); g_object_unref (key_fragment); + + demux->reset_crypto = FALSE; } gst_adapter_push (demux->adapter, buffer); @@ -1989,6 +1991,7 @@ gst_hls_demux_get_next_fragment (GstHLSDemux * demux, demux->current_timestamp = timestamp; demux->current_duration = duration; demux->starting_fragment = TRUE; + demux->reset_crypto = TRUE; demux->current_key = key; demux->current_iv = iv; diff --git a/ext/hls/gsthlsdemux.h b/ext/hls/gsthlsdemux.h index 5b8e69b512..76f6f84d10 100644 --- a/ext/hls/gsthlsdemux.h +++ b/ext/hls/gsthlsdemux.h @@ -121,6 +121,7 @@ struct _GstHLSDemux GstClockTime current_timestamp; GstClockTime current_duration; gboolean starting_fragment; + gboolean reset_crypto; gint64 download_start_time; gint64 download_total_time; gint64 download_total_bytes;