[vlc-devel] [PATCH] httplive.c: fix hls_Read (when caller skips data)

Frédéric Yhuel fyhuel at viotech.net
Thu Dec 29 12:14:03 CET 2011


I have also fixed a comment
---
 modules/stream_filter/httplive.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 4d60d8a..47b99a1 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -78,7 +78,8 @@ typedef struct hls_stream_s
     int         sequence;   /* media sequence number */
     int         duration;   /* maximum duration per segment (s) */
     uint64_t    bandwidth;  /* bandwidth usage of segments (bits per second)*/
-    uint64_t    size;       /* stream length (segment->duration * hls->bandwidth/8) */
+    uint64_t    size;       /* stream length = Sum for all segments(
+                                    segment->duration * hls->bandwidth/8 ) */
 
     vlc_array_t *segments;  /* list of segments */
     vlc_url_t   url;        /* uri to m3u8 */
@@ -1912,7 +1913,8 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read)
 
         if (len > 0)
         {
-            memcpy(p_read + copied, segment->data->p_buffer, len);
+            if( p_read ) /* otherwise caller skips data */
+                memcpy(p_read + copied, segment->data->p_buffer, len);
             segment->data->i_buffer -= len;
             segment->data->p_buffer += len;
             copied += len;
-- 
1.7.5.4




More information about the vlc-devel mailing list