[gvfs/gnome-3-20] afc: Fix GStreamer playback of native files
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-20] afc: Fix GStreamer playback of native files
- Date: Thu, 9 Jun 2016 10:52:40 +0000 (UTC)
commit 3e4786c9805ddcd0d173b44e75c1e5100e8fb225
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jun 8 17:35:52 2016 +0200
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.
https://bugzilla.gnome.org/show_bug.cgi?id=767405
daemon/gvfsbackendafc.c | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 2d8da14..382ca71 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -1427,7 +1427,7 @@ g_vfs_backend_afc_write (GVfsBackend *backend,
g_vfs_job_succeeded (G_VFS_JOB(job));
}
-static int
+static goffset
g_vfs_backend_afc_seek (GVfsBackendAfc *self,
GVfsJob *job,
GVfsBackendHandle handle,
@@ -1436,12 +1436,13 @@ g_vfs_backend_afc_seek (GVfsBackendAfc *self,
{
int afc_seek_type;
FileHandle *fh;
+ guint64 new_offset;
if ((afc_seek_type = gvfs_seek_type_to_lseek (type)) == -1)
{
g_vfs_job_failed(job, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Unsupported seek type"));
- return 1;
+ return -1;
}
fh = (FileHandle *) handle;
@@ -1449,11 +1450,13 @@ g_vfs_backend_afc_seek (GVfsBackendAfc *self,
if (G_UNLIKELY(g_vfs_backend_afc_check (afc_file_seek (fh->afc_cli,
fh->fd, offset, afc_seek_type),
job)))
- {
- return 1;
- }
+ return -1;
+
+ if (G_UNLIKELY(g_vfs_backend_afc_check (afc_file_tell (fh->afc_cli, fh->fd, &new_offset),
+ job)))
+ return -1;
- return 0;
+ return new_offset;
}
static void
@@ -1464,15 +1467,17 @@ g_vfs_backend_afc_seek_on_read (GVfsBackend *backend,
GSeekType type)
{
GVfsBackendAfc *self;
+ goffset new_offset;
g_return_if_fail (handle != NULL);
self = G_VFS_BACKEND_AFC(backend);
g_return_if_fail (self->connected);
- if (!g_vfs_backend_afc_seek (self, G_VFS_JOB(job), handle, offset, type))
+ new_offset = g_vfs_backend_afc_seek (self, G_VFS_JOB(job), handle, offset, type);
+ if (new_offset >= 0)
{
- g_vfs_job_seek_read_set_offset (job, offset);
+ g_vfs_job_seek_read_set_offset (job, new_offset);
g_vfs_job_succeeded (G_VFS_JOB(job));
}
}
@@ -1485,15 +1490,17 @@ g_vfs_backend_afc_seek_on_write (GVfsBackend *backend,
GSeekType type)
{
GVfsBackendAfc *self;
+ goffset new_offset;
g_return_if_fail (handle != NULL);
self = G_VFS_BACKEND_AFC(backend);
g_return_if_fail (self->connected);
- if (!g_vfs_backend_afc_seek (self, G_VFS_JOB(job), handle, offset, type))
+ new_offset = g_vfs_backend_afc_seek (self, G_VFS_JOB(job), handle, offset, type);
+ if (new_offset >= 0)
{
- g_vfs_job_seek_write_set_offset (job, offset);
+ g_vfs_job_seek_write_set_offset (job, new_offset);
g_vfs_job_succeeded (G_VFS_JOB(job));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]