mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-30 19:18:31 +00:00
filesrc: Properly handle lseek return value
On windows we use _lseeki64 which returns a guint64. The only error code lseek and _lseeki64 return is a casted -1, therefore just do that to handle all platforms Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8229>
This commit is contained in:
parent
77ad891e68
commit
9f4f500543
1 changed files with 3 additions and 3 deletions
|
@ -325,7 +325,7 @@ gst_file_src_fill (GstBaseSrc * basesrc, guint64 offset, guint length,
|
|||
off_t res;
|
||||
|
||||
res = lseek (src->fd, offset, SEEK_SET);
|
||||
if (G_UNLIKELY (res < 0 || res != offset))
|
||||
if (G_UNLIKELY (res == (off_t) - 1 || res != offset))
|
||||
goto seek_failed;
|
||||
|
||||
src->read_position = offset;
|
||||
|
@ -546,14 +546,14 @@ gst_file_src_start (GstBaseSrc * basesrc)
|
|||
{
|
||||
off_t res = lseek (src->fd, 0, SEEK_END);
|
||||
|
||||
if (res < 0) {
|
||||
if (res == (off_t) - 1) {
|
||||
GST_LOG_OBJECT (src, "disabling seeking, lseek failed: %s",
|
||||
g_strerror (errno));
|
||||
src->seekable = FALSE;
|
||||
} else {
|
||||
res = lseek (src->fd, 0, SEEK_SET);
|
||||
|
||||
if (res < 0) {
|
||||
if (res == (off_t) - 1) {
|
||||
/* We really don't like not being able to go back to 0 */
|
||||
src->seekable = FALSE;
|
||||
goto lseek_wonky;
|
||||
|
|
Loading…
Reference in a new issue