After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 767405 - afc: Fix GStreamer playback of native files
afc: Fix GStreamer playback of native files
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2016-06-08 15:40 UTC by Bastien Nocera
Modified: 2016-06-09 10:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
afc: Fix GStreamer playback of native files (3.46 KB, patch)
2016-06-08 15:40 UTC, Bastien Nocera
none Details | Review
afc: Fix GStreamer playback of native files (3.44 KB, patch)
2016-06-09 09:43 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2016-06-08 15:40:35 UTC
.
Comment 1 Bastien Nocera 2016-06-08 15:40:40 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.
Comment 2 Ondrej Holy 2016-06-09 07:38:04 UTC
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
Comment 3 Bastien Nocera 2016-06-09 09:43:28 UTC
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.