GNOME Bugzilla – Bug 767405
afc: Fix GStreamer playback of native files
Last modified: 2016-06-09 10:05:53 UTC
.
Created attachment 329403 [details] [review] afc: Fix GStreamer playback of native files GStreamer gets very confused when the offset after a seek isn't what it expected, and told us that the "Stream contains no data." when trying to play back using giosrc. But we could play the video just fine going through fuse. FUSE hides bugs with relative seeks, such as our absolute offset being wrong when doing absolute seeks. To make sure that the offset we return is correct, call tell() and use that as the new offset.
Review of attachment 329403 [details] [review]: Good catch! I guess that current behavioral may cause troubles for various clients. The patch looks overall good, however there is a problem with the unsigned offsets... ::: daemon/gvfsbackendafc.c @@ +1458,3 @@ } +static guint64 Would be better to use gint64/goffset for offsets: static goffset @@ +1467,3 @@ int afc_seek_type; FileHandle *fh; + guint64 new_offset = -1; It is not really nice to set -1 in unsigned, however afc_file_seek wants unsigned, so let's omit the initialization: guint64 new_offset; @@ +1473,3 @@ g_vfs_job_failed(job, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Unsupported seek type")); + return new_offset; return -1; @@ +1481,3 @@ fh->fd, offset, afc_seek_type), job))) + return new_offset; return -1; @@ +1498,3 @@ { GVfsBackendAfc *self; + guint64 new_offset; goffset new_offset; @@ +1506,3 @@ + new_offset = g_vfs_backend_afc_seek (self, G_VFS_JOB(job), handle, offset, type); + if (new_offset >= 0) This is always true obviously, because of guint64. @@ +1521,3 @@ { GVfsBackendAfc *self; + guint64 new_offset; goffset new_offset; @@ +1529,3 @@ + new_offset = g_vfs_backend_afc_seek (self, G_VFS_JOB(job), handle, offset, type); + if (new_offset >= 0) dtto
Created attachment 329447 [details] [review] afc: Fix GStreamer playback of native files GStreamer gets very confused when the offset after a seek isn't what it expected, and told us that the "Stream contains no data." when trying to play back using giosrc. But we could play the video just fine going through fuse. FUSE hides bugs with relative seeks, such as our absolute offset being wrong when doing absolute seeks. To make sure that the offset we return is correct, call tell() and use that as the new offset.