summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <ts.santos@sisa.samsung.com>2014-04-28 20:01:48 -0300
committerThiago Santos <ts.santos@sisa.samsung.com>2014-04-29 18:49:15 -0300
commit587851ba103aef22d4d83665792bb9a09edb7bea (patch)
tree98c6c4c30776ab778e6a9d06b7a386ea20898880
parentff395a75655e2664601aeee029f615b73ee4fe29 (diff)
downloadgstreamer-plugins-bad-587851ba103aef22d4d83665792bb9a09edb7bea.tar.gz
hlsdemux: properly flush decryption status on seeks
Avoids mixing decryption of different fragments when seeking happens and leading to broken stream output.
-rw-r--r--ext/hls/gsthlsdemux.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c
index 450d2739e..eed885df3 100644
--- a/ext/hls/gsthlsdemux.c
+++ b/ext/hls/gsthlsdemux.c
@@ -388,6 +388,16 @@ gst_hls_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
g_rec_mutex_lock (&demux->stream_lock);
+ /* properly cleanup pending decryption status */
+ if (flags & GST_SEEK_FLAG_FLUSH) {
+ if (demux->adapter)
+ gst_adapter_clear (demux->adapter);
+ if (demux->pending_buffer)
+ gst_buffer_unref (demux->pending_buffer);
+ demux->pending_buffer = NULL;
+ gst_hls_demux_decrypt_end (demux);
+ }
+
/* Use I-frame variants for trick modes */
if ((rate > 1.0 || rate < -1.0) && demux->segment.rate >= -1.0
&& demux->segment.rate <= 1.0) {
@@ -1250,6 +1260,7 @@ gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose)
demux->pending_buffer = NULL;
demux->current_key = NULL;
demux->current_iv = NULL;
+ gst_hls_demux_decrypt_end (demux);
demux->current_download_rate = -1;
}
@@ -1681,8 +1692,10 @@ decrypt_fragment (GstHLSDemux * demux, gsize length,
static void
gst_hls_demux_decrypt_end (GstHLSDemux * demux)
{
- if (demux->aes_ctx)
+ if (demux->aes_ctx) {
gcry_cipher_close (demux->aes_ctx);
+ demux->aes_ctx = NULL;
+ }
}
#endif