[vlc-commits] commit: stream_filter/httplive.c: sanity checking in GetSegment() ( Jean-Paul Saman )

git at videolan.org git at videolan.org
Fri Dec 31 17:55:47 CET 2010


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Dec 31 14:10:31 2010 +0100| [a84de9b103ee17e5eda7175f640aca40243ca59f] | committer: Jean-Paul Saman 

stream_filter/httplive.c: sanity checking in GetSegment()

Print a warning if the download segment counter and playback segment counter are
less then 3 segments apart. Print and error if they are the same.

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

 modules/stream_filter/httplive.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 26d0204..ba2c87c 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1660,7 +1660,7 @@ static segment_t *GetSegment(stream_t *s)
             {
                 p_sys->b_cache = hls->b_cache;
                 vlc_mutex_unlock(&hls->lock);
-                return segment;
+                goto check;
             }
         }
         vlc_mutex_unlock(&hls->lock);
@@ -1695,7 +1695,7 @@ static segment_t *GetSegment(stream_t *s)
             p_sys->playback.current = i_stream;
             p_sys->b_cache = hls->b_cache;
             vlc_mutex_unlock(&hls->lock);
-            return segment;
+            goto check;
         }
         vlc_mutex_unlock(&hls->lock);
 
@@ -1709,6 +1709,14 @@ static segment_t *GetSegment(stream_t *s)
     }
     /* */
     return NULL;
+
+check:
+    /* sanity check */
+    if (p_sys->thread->segment - p_sys->playback.segment == 0)
+        msg_Err(s, "playback will stall");
+    else if (p_sys->thread->segment - p_sys->playback.segment < 3)
+        msg_Warn(s, "playback in danger of stalling");
+    return segment;
 }
 
 static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read)



More information about the vlc-commits mailing list