smoothstreaming: clear live adapter on seek

In live streaming, buffers sent by souphttpsrc are pushed to the live
adapter. The buffers in the adapter are sent out of mssdemux when it
is greater than 4096 bytes.

Occasionally, when seeking in live streams, if seek occurs just
after the last data chunk was received, and if this data chunk is
smaller than 4096 bytes, it will be kept in the live adapter.
This remaining data in the live adapter will be erroneously prepended
to the new data that is downloaded after seek and pushed out.
When qtdemux receives this data, since it does not start with
a moof box, it is impossible to demux the fragment, and bogus
size error will occur.

Clear out the live adapter on seek so that no unnecessary remaining
data is pushed out together with the new fragment after seeking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1345>
This commit is contained in:
Hosang Lee 2020-06-16 11:16:37 +09:00 committed by GStreamer Merge Bot
parent cd618f19b9
commit f7a8ece5ef
2 changed files with 12 additions and 1 deletions

View file

@ -1223,7 +1223,10 @@ gst_mss_manifest_seek (GstMssManifest * manifest, gboolean forward,
GSList *iter;
for (iter = manifest->streams; iter; iter = g_slist_next (iter)) {
gst_mss_stream_seek (iter->data, forward, 0, time, NULL);
GstMssStream *stream = iter->data;
gst_mss_manifest_live_adapter_clear (stream);
gst_mss_stream_seek (stream, forward, 0, time, NULL);
}
}
@ -1612,6 +1615,13 @@ gst_mss_manifest_live_adapter_take_buffer (GstMssStream * stream, gsize nbytes)
return gst_adapter_take_buffer (stream->live_adapter, nbytes);
}
void
gst_mss_manifest_live_adapter_clear (GstMssStream * stream)
{
if (stream->live_adapter)
gst_adapter_clear (stream->live_adapter);
}
gboolean
gst_mss_stream_fragment_parsing_needed (GstMssStream * stream)
{

View file

@ -77,6 +77,7 @@ const gchar * gst_mss_stream_type_name (GstMssStreamType streamtype);
void gst_mss_manifest_live_adapter_push(GstMssStream * stream, GstBuffer * buffer);
gsize gst_mss_manifest_live_adapter_available(GstMssStream * stream);
GstBuffer * gst_mss_manifest_live_adapter_take_buffer(GstMssStream * stream, gsize nbytes);
void gst_mss_manifest_live_adapter_clear (GstMssStream * stream);
gboolean gst_mss_stream_fragment_parsing_needed(GstMssStream * stream);
void gst_mss_stream_parse_fragment(GstMssStream * stream, GstBuffer * buffer);