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
This commit is contained in:
Thomas Bluemel 2014-06-20 08:20:55 -06:00 committed by Sebastian Dröge
parent ae99043506
commit b1fac8c781
2 changed files with 5 additions and 1 deletions

View file

@ -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;

View file

@ -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;