plugins/elements/gstfilesrc.c: If not using mmap'ed files try to seek to the end instead of the start to determine wh...

Original commit message from CVS:
Patch by: Jindrich Makovicka <jindrich.makovick at itonis dot tv>
* plugins/elements/gstfilesrc.c: (gst_file_src_start):
If not using mmap'ed files try to seek to the end instead of the
start to determine whether we can seek at all. This fixes the case
of 2GB+ files over NFS, where seeks in the first 2GB can succeed but
seeks for everything afterwards fail. Fixes #400656
This commit is contained in:
Jindrich Makovicka 2007-01-25 17:54:07 +00:00 committed by Sebastian Dröge
parent 76e88f9d37
commit 46848a3595
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2007-01-25 Sebastian Dröge <slomo@circular-chaos.org>
Patch by: Jindrich Makovicka <jindrich.makovick at itonis dot tv>
* plugins/elements/gstfilesrc.c: (gst_file_src_start):
If not using mmap'ed files try to seek to the end instead of the
start to determine whether we can seek at all. This fixes the case
of 2GB+ files over NFS, where seeks in the first 2GB can succeed but
seeks for everything afterwards fail. Fixes #400656
2007-01-25 Wim Taymans <wim@fluendo.com>
* gst/gstcaps.c: (_gst_caps_free), (gst_static_caps_get):

View file

@ -943,7 +943,7 @@ gst_file_src_start (GstBaseSrc * basesrc)
{
/* If not in mmap mode, we need to check if the underlying file is
* seekable. */
off_t res = lseek (src->fd, 0, SEEK_CUR);
off_t res = lseek (src->fd, 0, SEEK_END);
if (res < 0) {
GST_LOG_OBJECT (src, "disabling seeking, not in mmap mode and lseek "
@ -952,6 +952,7 @@ gst_file_src_start (GstBaseSrc * basesrc)
} else {
src->seekable = TRUE;
}
lseek (src->fd, 0, SEEK_SET);
}
/* We can only really do seeking on regular files - for other file types, we