[vlc-devel] [PATCH 17/48] hls: Add random time decoding

Hugo Beauzée-Luyssen beauze.h at gmail.com
Mon Jan 9 16:16:26 CET 2012


From: Luc Saillard <luc.saillard at sfr.com>

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

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index ecac6fe..a7089b6 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1135,6 +1135,8 @@ static int hls_DownloadSegmentKey(stream_t *s, segment_t *seg)
 
     memcpy(seg->psz_AES_key, aeskey, AES_BLOCK_SIZE);
 
+    //msleep((1+(rand() % 10)) * 1000000);
+
     stream_Delete(p_m3u8);
 
     return VLC_SUCCESS;
@@ -1520,6 +1522,11 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se
     }
     mtime_t duration = mdate() - start;
 
+    msg_Info(s, "downloaded segment %d from stream %d in %dms",
+                segment->sequence, *cur_stream, (int)(duration/1000));
+
+
+    start = mdate();
     /* If the segment is encrypted, decode it */
     if (hls_DecodeSegmentData(s, hls, segment) != VLC_SUCCESS)
     {
@@ -1527,10 +1534,12 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se
         return VLC_EGENERIC;
     }
 
+    duration = mdate() - start;
+
     vlc_mutex_unlock(&segment->lock);
 
-    msg_Info(s, "downloaded segment %d from stream %d",
-                segment->sequence, *cur_stream);
+    msg_Info(s, "decode segment %d from stream %d in %dms",
+                segment->sequence, *cur_stream, (int)(duration/1000));
 
     /* Do not change bandwidth */
     return VLC_SUCCESS;
@@ -1812,6 +1821,8 @@ static int hls_Download(stream_t *s, segment_t *segment)
         curlen += length;
     } while (vlc_object_alive(s) && s->p_sys->b_quit == false);
 
+    //msleep((1+(rand() % 10)) * 1000000);
+
     stream_Delete(p_ts);
     return VLC_SUCCESS;
 }
-- 
1.7.8.3




More information about the vlc-devel mailing list