summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2012-05-14 15:51:29 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2012-05-15 09:59:52 +0100
commit8d1305023fea78e0b6c1f8b7fd69173c2b7b919f (patch)
tree864747f39026d6885f9f76c5c78e4eb060a0efb1 /ext
parenta2c29123887576267fedfbd932d8e140c8511122 (diff)
downloadgstreamer-plugins-good-8d1305023fea78e0b6c1f8b7fd69173c2b7b919f.tar.gz
souphttpsrc: fix possible data corruption after seeking
Consider a downstream element that may issue seeks in very short succession (e.g. queue2), depending on the access pattern of the downstream element (e.g. qtdemux with audio/video chunks interleaved so that there's always a sizeable gap between the current chunks for each stream). In this case, queue2 will maintain two ranges, and even when it serves a chunk from memory, it will switch ranges and make souphttpsrc seek to the end of the available data for that range, assuming that that's where we'll want to continue reading from next. This may lead to the following seek request pattern: - source reading position A - seek to B - now reading position still A, requested_postion is B - streaming thread to be restarted to continue from B - seek to A, before streaming thread had time to do the seek - do_seek() now sees reading position == seek position and returns early. - however, requested position is still B from the earlier seek request - streaming thread starts up, sees that a seek to B is pending and requests data from B from the server, while the GstBaseSrc segment has of course been updated/reset to position A, which was the last seek request. - we will now send data for position B and pretend that's the data from position A (via the newsegment event, etc.) - this causes data corruption Reproducible doing seek-emulated fast-forward/backward on 006648.
Diffstat (limited to 'ext')
-rw-r--r--ext/soup/gstsouphttpsrc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index 83b60f780..aa019ee24 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -1372,8 +1372,9 @@ gst_soup_http_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
GST_DEBUG_OBJECT (src, "do_seek(%" G_GUINT64_FORMAT ")", segment->start);
- if (src->read_position == segment->start) {
- GST_DEBUG_OBJECT (src, "Seeking to current read position");
+ if (src->read_position == segment->start &&
+ src->request_position == src->read_position) {
+ GST_DEBUG_OBJECT (src, "Seek to current read position and no seek pending");
return TRUE;
}