[vlc-devel] [RFC PATCH 2/2] access/demux: Make use of live-network-caching variable
Julian Scheel
julian at jusst.de
Wed Apr 8 13:02:44 CEST 2015
Just realized, this one lacks a lot braces (operator precendence of *
over ?) - will update them.
Am 08.04.2015 um 12:14 schrieb Julian Scheel:
> Use either network-caching or live-network-caching depending on whether a
> source is seekable or not.
>
> Signed-off-by: Julian Scheel <julian at jusst.de>
> ---
> modules/access/avio.c | 10 +++++++++-
> modules/access/file.c | 4 +++-
> modules/access/ftp.c | 4 +++-
> modules/access/http.c | 4 +++-
> modules/access/live555.cpp | 4 +++-
> modules/access/mms/mmsh.c | 4 +++-
> modules/access/mms/mmstu.c | 4 +++-
> modules/access/rtp/rtp.c | 2 +-
> modules/access/rtsp/access.c | 2 +-
> modules/access/tcp.c | 2 +-
> modules/access/udp.c | 2 +-
> modules/access/vnc.c | 2 +-
> modules/demux/dash/dash.cpp | 4 +++-
> modules/stream_filter/hds/hds.c | 2 +-
> modules/stream_filter/httplive.c | 3 ++-
> 15 files changed, 38 insertions(+), 15 deletions(-)
>
> diff --git a/modules/access/avio.c b/modules/access/avio.c
> index 50ef585..e2e0cde 100644
> --- a/modules/access/avio.c
> +++ b/modules/access/avio.c
> @@ -435,7 +435,15 @@ static int Control(access_t *access, int query, va_list args)
> return VLC_SUCCESS;
> case ACCESS_GET_PTS_DELAY: {
> int64_t *delay = va_arg(args, int64_t *);
> - *delay = INT64_C(1000) * var_InheritInteger(access, "network-caching");
> +#if LIBAVFORMAT_VERSION_MAJOR < 54
> + *delay = INT64_C(1000) * !sys->context->is_streamed ?
> + var_InheritInteger(access, "network-caching") :
> + var_InheritInteger(access, "live-network-caching");
> +#else
> + *delay = INT64_C(1000) * sys->context->seekable ?
> + var_InheritInteger(access, "network-caching") :
> + var_InheritInteger(access, "live-network-caching");
> +#endif
> return VLC_SUCCESS;
> }
> case ACCESS_SET_PAUSE_STATE: {
> diff --git a/modules/access/file.c b/modules/access/file.c
> index fbe6fa6..2cd0c60 100644
> --- a/modules/access/file.c
> +++ b/modules/access/file.c
> @@ -407,7 +407,9 @@ static int FileControl( access_t *p_access, int i_query, va_list args )
> case ACCESS_GET_PTS_DELAY:
> pi_64 = (int64_t*)va_arg( args, int64_t * );
> if (IsRemote (p_sys->fd, p_access->psz_filepath))
> - *pi_64 = var_InheritInteger (p_access, "network-caching");
> + *pi_64 = p_access->pf_seek != NoSeek ?
> + var_InheritInteger (p_access, "network-caching") :
> + var_InheritInteger (p_access, "live-network-caching");
> else
> *pi_64 = var_InheritInteger (p_access, "file-caching");
> *pi_64 *= 1000;
> diff --git a/modules/access/ftp.c b/modules/access/ftp.c
> index e0dc371..da4073d 100644
> --- a/modules/access/ftp.c
> +++ b/modules/access/ftp.c
> @@ -897,7 +897,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
> case ACCESS_GET_PTS_DELAY:
> pi_64 = (int64_t*)va_arg( args, int64_t * );
> *pi_64 = INT64_C(1000)
> - * var_InheritInteger( p_access, "network-caching" );
> + * !p_access->p_sys->directory ?
> + var_InheritInteger( p_access, "network-caching" ):
> + var_InheritInteger( p_access, "live-network-caching" );
> break;
>
> case ACCESS_SET_PAUSE_STATE:
> diff --git a/modules/access/http.c b/modules/access/http.c
> index 31328ab..76cb85e 100644
> --- a/modules/access/http.c
> +++ b/modules/access/http.c
> @@ -967,7 +967,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
> case ACCESS_GET_PTS_DELAY:
> pi_64 = (int64_t*)va_arg( args, int64_t * );
> *pi_64 = INT64_C(1000)
> - * var_InheritInteger( p_access, "network-caching" );
> + * p_sys->b_seekable ?
> + var_InheritInteger( p_access, "network-caching" ) :
> + var_InheritInteger( p_access, "live-network-caching" );
> break;
>
> case ACCESS_GET_SIZE:
> diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
> index a3faa77..06005fc 100644
> --- a/modules/access/live555.cpp
> +++ b/modules/access/live555.cpp
> @@ -1664,7 +1664,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
> case DEMUX_GET_PTS_DELAY:
> pi64 = (int64_t*)va_arg( args, int64_t * );
> *pi64 = INT64_C(1000)
> - * var_InheritInteger( p_demux, "network-caching" );
> + * ( p_sys->rtsp && p_sys->f_npt_length > 0 ) ?
> + var_InheritInteger( p_demux, "network-caching" ) :
> + var_InheritInteger( p_demux, "live-network-caching" );
> return VLC_SUCCESS;
>
> default:
> diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
> index d1d3c2d..c2861ac 100644
> --- a/modules/access/mms/mmsh.c
> +++ b/modules/access/mms/mmsh.c
> @@ -250,7 +250,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
> case ACCESS_GET_PTS_DELAY:
> pi_64 = (int64_t*)va_arg( args, int64_t * );
> *pi_64 = INT64_C(1000)
> - * var_InheritInteger( p_access, "network-caching" );
> + * !p_sys->b_broadcast ?
> + var_InheritInteger( p_access, "network-caching" ) :
> + var_InheritInteger( p_access, "live-network-caching" );
> break;
>
> case ACCESS_GET_PRIVATE_ID_STATE:
> diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
> index 4c0a8c2..c0b5702 100644
> --- a/modules/access/mms/mmstu.c
> +++ b/modules/access/mms/mmstu.c
> @@ -254,7 +254,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
> case ACCESS_GET_PTS_DELAY:
> pi_64 = (int64_t*)va_arg( args, int64_t * );
> *pi_64 = INT64_C(1000)
> - * var_InheritInteger( p_access, "network-caching" );
> + * p_sys->b_seekable ?
> + var_InheritInteger( p_access, "network-caching" ) :
> + var_InheritInteger( p_access, "live-network-caching" );
> break;
>
> case ACCESS_GET_PRIVATE_ID_STATE:
> diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
> index 455c0e8..be3cd58 100644
> --- a/modules/access/rtp/rtp.c
> +++ b/modules/access/rtp/rtp.c
> @@ -381,7 +381,7 @@ static int Control (demux_t *demux, int query, va_list args)
> case DEMUX_GET_PTS_DELAY:
> {
> int64_t *v = va_arg (args, int64_t *);
> - *v = INT64_C(1000) * var_InheritInteger (demux, "network-caching");
> + *v = INT64_C(1000) * var_InheritInteger (demux, "live-network-caching");
> return VLC_SUCCESS;
> }
>
> diff --git a/modules/access/rtsp/access.c b/modules/access/rtsp/access.c
> index 2a52a1b..c8807e4 100644
> --- a/modules/access/rtsp/access.c
> +++ b/modules/access/rtsp/access.c
> @@ -323,7 +323,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
>
> case ACCESS_GET_PTS_DELAY:
> *va_arg( args, int64_t * ) = INT64_C(1000)
> - * var_InheritInteger(p_access, "network-caching");
> + * var_InheritInteger(p_access, "live-network-caching");
> break;
>
> case ACCESS_SET_PAUSE_STATE:
> diff --git a/modules/access/tcp.c b/modules/access/tcp.c
> index 3fbf7f2..9beb6c4 100644
> --- a/modules/access/tcp.c
> +++ b/modules/access/tcp.c
> @@ -175,7 +175,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
> case ACCESS_GET_PTS_DELAY:
> pi_64 = (int64_t*)va_arg( args, int64_t * );
> *pi_64 = INT64_C(1000)
> - * var_InheritInteger( p_access, "network-caching" );
> + * var_InheritInteger( p_access, "live-network-caching" );
> break;
>
> case ACCESS_SET_PAUSE_STATE:
> diff --git a/modules/access/udp.c b/modules/access/udp.c
> index c61bf8a..55f74a9 100644
> --- a/modules/access/udp.c
> +++ b/modules/access/udp.c
> @@ -219,7 +219,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
> case ACCESS_GET_PTS_DELAY:
> pi_64 = (int64_t*)va_arg( args, int64_t * );
> *pi_64 = INT64_C(1000)
> - * var_InheritInteger(p_access, "network-caching");
> + * var_InheritInteger(p_access, "live-network-caching");
> break;
>
> default:
> diff --git a/modules/access/vnc.c b/modules/access/vnc.c
> index 4a4a94f..608ce0e 100644
> --- a/modules/access/vnc.c
> +++ b/modules/access/vnc.c
> @@ -298,7 +298,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
> case DEMUX_GET_PTS_DELAY:
> pi64 = (int64_t*)va_arg( args, int64_t * );
> *pi64 = INT64_C(1000)
> - * var_InheritInteger( p_demux, "network-caching" );
> + * var_InheritInteger( p_demux, "live-network-caching" );
> return VLC_SUCCESS;
>
> case DEMUX_GET_TIME:
> diff --git a/modules/demux/dash/dash.cpp b/modules/demux/dash/dash.cpp
> index ee9bada..c623aa3 100644
> --- a/modules/demux/dash/dash.cpp
> +++ b/modules/demux/dash/dash.cpp
> @@ -241,7 +241,9 @@ static int Control (demux_t *p_demux, int i_query, va_list args)
>
> case DEMUX_GET_PTS_DELAY:
> *va_arg (args, int64_t *) = INT64_C(1000) *
> - var_InheritInteger(p_demux, "network-caching");
> + p_sys->p_dashManager->seekAble() ?
> + var_InheritInteger(p_demux, "network-caching") :
> + var_InheritInteger(p_demux, "live-network-caching");
> break;
>
> case DEMUX_GET_META:
> diff --git a/modules/stream_filter/hds/hds.c b/modules/stream_filter/hds/hds.c
> index 9a74b67..9ee209b 100644
> --- a/modules/stream_filter/hds/hds.c
> +++ b/modules/stream_filter/hds/hds.c
> @@ -1945,7 +1945,7 @@ static int Control( stream_t *s, int i_query, va_list args )
> break;
> case STREAM_GET_PTS_DELAY:
> *va_arg (args, int64_t *) = INT64_C(1000) *
> - var_InheritInteger(s, "network-caching");
> + var_InheritInteger(s, "live-network-caching");
> break;
> case STREAM_GET_POSITION:
> *(va_arg (args, uint64_t *)) = s->p_sys->playback_offset;
> diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
> index 24b44c4..2705baf 100644
> --- a/modules/stream_filter/httplive.c
> +++ b/modules/stream_filter/httplive.c
> @@ -2728,7 +2728,8 @@ static int Control(stream_t *s, int i_query, va_list args)
> break;
> case STREAM_GET_PTS_DELAY:
> *va_arg (args, int64_t *) = INT64_C(1000) *
> - var_InheritInteger(s, "network-caching");
> + hls_MaySeek(s) ? var_InheritInteger(s, "network-caching") :
> + var_InheritInteger(s, "live-network-caching");
> break;
> default:
> return VLC_EGENERIC;
>
More information about the vlc-devel
mailing list