mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
hlsdemux: Clear pending data when needed
When switching fragments we don't want to keep any data around from the last one, and also forget about all data when doing flushing seeks or selecting new bitrates. https://bugzilla.gnome.org/show_bug.cgi?id=764684
This commit is contained in:
parent
ca9f62e1d0
commit
3469104a47
1 changed files with 15 additions and 6 deletions
|
@ -229,6 +229,15 @@ gst_hls_demux_get_bitrate (GstHLSDemux * hlsdemux)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_hls_demux_clear_pending_data (GstHLSDemux * hlsdemux)
|
||||
{
|
||||
gst_hls_demux_decrypt_end (hlsdemux);
|
||||
gst_adapter_clear (hlsdemux->pending_encrypted_data);
|
||||
gst_buffer_replace (&hlsdemux->pending_decrypted_buffer, NULL);
|
||||
gst_buffer_replace (&hlsdemux->pending_typefind_buffer, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
|
||||
{
|
||||
|
@ -253,7 +262,7 @@ gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
|
|||
|
||||
/* properly cleanup pending decryption status */
|
||||
if (flags & GST_SEEK_FLAG_FLUSH) {
|
||||
gst_hls_demux_decrypt_end (hlsdemux);
|
||||
gst_hls_demux_clear_pending_data (hlsdemux);
|
||||
}
|
||||
|
||||
/* Use I-frame variants for trick modes */
|
||||
|
@ -382,6 +391,7 @@ gst_hls_demux_setup_streams (GstAdaptiveDemux * demux)
|
|||
GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
|
||||
|
||||
/* only 1 output supported */
|
||||
gst_hls_demux_clear_pending_data (hlsdemux);
|
||||
gst_adaptive_demux_stream_new (demux, gst_hls_demux_create_pad (hlsdemux));
|
||||
|
||||
hlsdemux->reset_pts = TRUE;
|
||||
|
@ -511,6 +521,8 @@ gst_hls_demux_start_fragment (GstAdaptiveDemux * demux,
|
|||
g_object_unref (key_fragment);
|
||||
}
|
||||
|
||||
gst_hls_demux_clear_pending_data (hlsdemux);
|
||||
|
||||
return TRUE;
|
||||
|
||||
key_failed:
|
||||
|
@ -610,10 +622,8 @@ gst_hls_demux_finish_fragment (GstAdaptiveDemux * demux,
|
|||
hlsdemux->pending_decrypted_buffer, TRUE);
|
||||
hlsdemux->pending_decrypted_buffer = NULL;
|
||||
}
|
||||
} else {
|
||||
gst_buffer_replace (&hlsdemux->pending_decrypted_buffer, NULL);
|
||||
gst_adapter_clear (hlsdemux->pending_encrypted_data);
|
||||
}
|
||||
gst_hls_demux_clear_pending_data (hlsdemux);
|
||||
|
||||
if (ret == GST_FLOW_OK || ret == GST_FLOW_NOT_LINKED)
|
||||
return gst_adaptive_demux_stream_advance_fragment (demux, stream,
|
||||
|
@ -773,8 +783,7 @@ gst_hls_demux_reset (GstAdaptiveDemux * ademux)
|
|||
demux->client = gst_m3u8_client_new ("", NULL);
|
||||
|
||||
demux->srcpad_counter = 0;
|
||||
gst_adapter_clear (demux->pending_encrypted_data);
|
||||
gst_buffer_replace (&demux->pending_decrypted_buffer, NULL);
|
||||
gst_hls_demux_clear_pending_data (demux);
|
||||
gst_buffer_replace (&demux->pending_typefind_buffer, NULL);
|
||||
if (demux->current_key) {
|
||||
g_free (demux->current_key);
|
||||
|
|
Loading…
Reference in a new issue