[FFmpeg-devel] libavformat/subfile: Fix SEEK_END seeking

Submitted by Andreas Rheinhardt on July 15, 2019, 5:09 p.m.

Details

Message ID 20190715170904.46574-1-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt July 15, 2019, 5:09 p.m.
Up until now, when performing a SEEK_END seek, the subfile protocol
ignored the desired position (relative to EOF) and used the current
absolute offset in the input file instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
A situation affected by this is a concatenation of concat and subfile:
For some reason, SEEK_SIZE is not implemented for the concat protocol,
so that SEEK_END is used as a fallback. Depending on parameter
combinations, this can mean that the duration of e.g. transport streams
can't be estimated.
Sorry for not spotting this in 4877b586; the bug here was already
present in the initial commit of this protocol.

 libavformat/subfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/subfile.c b/libavformat/subfile.c
index 2f162e0a34..8210dfb6b3 100644
--- a/libavformat/subfile.c
+++ b/libavformat/subfile.c
@@ -135,7 +135,7 @@  static int64_t subfile_seek(URLContext *h, int64_t pos, int whence)
         new_pos += pos;
         break;
     case SEEK_END:
-        new_pos = end + c->pos;
+        new_pos = end + pos;
         break;
     }
     if (new_pos < c->start)