summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bluemel <tbluemel@control4.com>2014-06-20 08:20:55 -0600
committerSebastian Dröge <sebastian@centricular.com>2014-06-22 14:21:35 +0200
commitb1fac8c781b8e4bab13da931116f25854b1b1494 (patch)
tree9ec3238c8cd030756ad578fed0c95cc337c56d3b
parentae990435063bbb0f1fd2caf1726805e2d7086790 (diff)
downloadgstreamer-plugins-bad-b1fac8c781b8e4bab13da931116f25854b1b1494.tar.gz
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
-rw-r--r--ext/hls/gsthlsdemux.c5
-rw-r--r--ext/hls/gsthlsdemux.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c
index 5d39ed03c..466f665bb 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 5b8e69b51..76f6f84d1 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;