summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorHosang Lee <hosang10.lee@lge.com>2020-06-16 11:16:37 +0900
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-10-05 00:39:12 +0000
commitdbef01afd4af8dd9763fca0813a7333aba0fc434 (patch)
tree379b6234cd4751dfdd8613224e3457981f947135 /ext
parent958f0d65cc3191c8d0623f95702d316c0625a3a4 (diff)
downloadgstreamer-plugins-bad-dbef01afd4af8dd9763fca0813a7333aba0fc434.tar.gz
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/1649>
Diffstat (limited to 'ext')
-rw-r--r--ext/smoothstreaming/gstmssmanifest.c12
-rw-r--r--ext/smoothstreaming/gstmssmanifest.h1
2 files changed, 12 insertions, 1 deletions
diff --git a/ext/smoothstreaming/gstmssmanifest.c b/ext/smoothstreaming/gstmssmanifest.c
index 0ab4096e3..3a9af69f9 100644
--- a/ext/smoothstreaming/gstmssmanifest.c
+++ b/ext/smoothstreaming/gstmssmanifest.c
@@ -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)
{
diff --git a/ext/smoothstreaming/gstmssmanifest.h b/ext/smoothstreaming/gstmssmanifest.h
index 03b066ae5..0db632621 100644
--- a/ext/smoothstreaming/gstmssmanifest.h
+++ b/ext/smoothstreaming/gstmssmanifest.h
@@ -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);