[vlc-devel] [vlc-commits] access/file: don't read-ahead when processing remote contents ( closes #9885, refs #8446)

Tobias Güntner fatbull at web.de
Tue Nov 25 18:29:04 CET 2014


> vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sun Apr 27 12:33:15 2014 +0200| [b8b8c438f8f65a93da82364c8fea1dbf987c4a8e] | committer: Felix Paul Kühne
>
> access/file: don't read-ahead when processing remote contents (closes #9885, refs #8446)
>
> OS X Mavericks takes read-ahead very seriously when accessing SMB drives, so it caches up to a 100 MB. However, when the end of said cache is reached, VLC will stutter because the file system needs to re-connect to the server first. Disabling read-ahead leads to a continous data flow at the media's bitrate.
>
> This solves a regression introduced in fe0a075ef3
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b8b8c438f8f65a93da82364c8fea1dbf987c4a8e
> ---
>
>  modules/access/file.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/modules/access/file.c b/modules/access/file.c
> index 6d4423e..6a1bde1 100644
> --- a/modules/access/file.c
> +++ b/modules/access/file.c
> @@ -235,12 +235,15 @@ int FileOpen( vlc_object_t *p_this )
>          posix_fadvise (fd, 0, 4096, POSIX_FADV_WILLNEED);
>          /* In most cases, we only read the file once. */
>          posix_fadvise (fd, 0, 0, POSIX_FADV_NOREUSE);
> -#ifdef F_RDAHEAD
> -        fcntl (fd, F_RDAHEAD, 1);
> -#endif
>  #ifdef F_NOCACHE
>          fcntl (fd, F_NOCACHE, 0);
>  #endif
> +#ifdef F_RDAHEAD
> +        if (IsRemote(fd, p_access->psz_filepath))
> +            fcntl (fd, F_RDAHEAD, 0);
> +        else
> +            fcntl (fd, F_RDAHEAD, 1);
> +#endif
>      }
>      else
>      {

I think this applies to vdr as well so I moved the code in a helper 
function. Works for me but it still needs to be tested on OS X.

I also attached a patch for mtp, but I'm not sure if it's correct.

Regards,
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Move-remote-file-check-to-core.patch
Type: text/x-patch
Size: 7988 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20141125/4f8a01d2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Create-helper-function-to-set-readahead-and-caching.patch
Type: text/x-patch
Size: 5647 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20141125/4f8a01d2/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Use-helper-function-to-set-readahead-and-caching.patch
Type: text/x-patch
Size: 1452 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20141125/4f8a01d2/attachment-0002.bin>


More information about the vlc-devel mailing list