[vlc-commits] stream_filter: smooth: allow pausing

Francois Cartegnie git at videolan.org
Tue Oct 28 15:14:55 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct 28 15:10:47 2014 +0100| [7656b3b4491272175984bcb48106f49e23e934f0] | committer: Francois Cartegnie

stream_filter: smooth: allow pausing

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

 modules/stream_filter/smooth/downloader.c |    9 ++++++++-
 modules/stream_filter/smooth/smooth.c     |    5 ++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/smooth/downloader.c b/modules/stream_filter/smooth/downloader.c
index bf3faf8..b941b97 100644
--- a/modules/stream_filter/smooth/downloader.c
+++ b/modules/stream_filter/smooth/downloader.c
@@ -604,6 +604,7 @@ void* sms_Thread( void *p_this )
      * the n+1^th advertised audio chunk or vice versa */
 
     uint64_t start_time = 0, lead = 0;
+    int64_t i_pts_delay;
 
     for( int i = 0; i < 3; i++ )
     {
@@ -634,7 +635,13 @@ void* sms_Thread( void *p_this )
 
         lead = get_lead( s );
 
-        while( lead > 10 * p_sys->timescale + start_time || NO_MORE_CHUNKS )
+        if ( stream_Control( s, STREAM_GET_PTS_DELAY, &i_pts_delay ) != VLC_SUCCESS ||
+             i_pts_delay < 1 )
+        {
+            i_pts_delay = 10 * p_sys->timescale + start_time;
+        }
+
+        while( lead > (uint64_t) i_pts_delay || NO_MORE_CHUNKS )
         {
             vlc_cond_wait( &p_sys->download.wait, &p_sys->download.lock_wait );
             lead = get_lead( s );
diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c
index 0919a2d..6e61aba 100644
--- a/modules/stream_filter/smooth/smooth.c
+++ b/modules/stream_filter/smooth/smooth.c
@@ -773,9 +773,9 @@ static int Control( stream_t *s, int i_query, va_list args )
             *(va_arg( args, bool * )) = true;
             break;
         case STREAM_CAN_FASTSEEK:
-        case STREAM_CAN_PAUSE: /* TODO */
             *(va_arg( args, bool * )) = false;
             break;
+        case STREAM_CAN_PAUSE: /* TODO */
         case STREAM_CAN_CONTROL_PACE:
             *(va_arg( args, bool * )) = !p_sys->b_live;
             break;
@@ -798,6 +798,9 @@ static int Control( stream_t *s, int i_query, va_list args )
             *va_arg (args, int64_t *) = INT64_C(1000) *
                 var_InheritInteger(s, "network-caching");
              break;
+        case STREAM_SET_PAUSE_STATE:
+            return (p_sys->b_live) ? VLC_EGENERIC : VLC_SUCCESS;
+            break;
         default:
             return VLC_EGENERIC;
     }



More information about the vlc-commits mailing list