[vlc-commits] Don't reset current HLS segment playback pointer on a failed seek

Chris Smowton git at videolan.org
Thu May 31 17:18:40 CEST 2012


vlc/vlc-2.0 | branch: master | Chris Smowton <cs448 at cam.ac.uk> | Wed May 30 14:30:54 2012 +0100| [8ee155f5685ce371d283af906c855d6620f8ae9b] | committer: Jean-Baptiste Kempf

Don't reset current HLS segment playback pointer on a failed seek

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 78baddd08043b952cae3ed973b8d7a561c7ba493)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=8ee155f5685ce371d283af906c855d6620f8ae9b
---

 modules/stream_filter/httplive.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index c2daad2..97d1adf 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -2350,16 +2350,12 @@ static int segment_Seek(stream_t *s, const uint64_t pos)
     uint64_t size = hls->size;
     int count = vlc_array_count(hls->segments);
 
-    /* restore current segment to start position */
-    segment_t *segment = segment_GetSegment(hls, p_sys->playback.segment);
-    if (segment == NULL)
+    segment_t *currentSegment = segment_GetSegment(hls, p_sys->playback.segment);
+    if (currentSegment == NULL)
     {
         vlc_mutex_unlock(&hls->lock);
         return VLC_EGENERIC;
     }
-    vlc_mutex_lock(&segment->lock);
-    segment_RestorePos(segment);
-    vlc_mutex_unlock(&segment->lock);
 
     for (int n = 0; n < count; n++)
     {
@@ -2398,7 +2394,13 @@ static int segment_Seek(stream_t *s, const uint64_t pos)
     /* */
     if (b_found)
     {
-        /* restore segment to start position */
+
+        /* restore current segment to start position */
+        vlc_mutex_lock(&currentSegment->lock);
+        segment_RestorePos(currentSegment);
+        vlc_mutex_unlock(&currentSegment->lock);
+
+        /* restore seeked segment to start position */
         segment_t *segment = segment_GetSegment(hls, p_sys->playback.segment);
         if (segment == NULL)
         {



More information about the vlc-commits mailing list