]> granicus.if.org Git - handbrake/commitdiff
sync: fix sync problem with delayed streams
authorJohn Stebbins <jstebbins.hb@gmail.com>
Sat, 18 Feb 2017 21:11:17 +0000 (14:11 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Sat, 18 Feb 2017 21:14:09 +0000 (14:14 -0700)
If a stream is delayed by a large amount and the first timestamp from
the stream is AV_NOPTS_VALUE, sync assumed a 0 timestamp which caused
loss of sync.  Drop the buffer instead.

(cherry picked from commit 6fec4838373fd50520a2499ff143c50e5d323f9f)

libhb/sync.c

index 9bc94de02e23227150c918996b5f13f69b63676f..f199feff8ea21a6b40eabbd5c3ef1e4f4ad95bd1 100644 (file)
@@ -1761,12 +1761,12 @@ static int UpdateSCR( sync_stream_t * stream, hb_buffer_t * buf )
     {
         // This should happen extremely rarely if ever.
         // But if we get here, this is the first buffer received for
-        // this stream.  Normally, some buffers will be queued for
+        // this stream. Normally, some buffers will be queued for
         // every stream before we ever call UpdateSCR.
-        // We don't really know what it's timestamp should be,
-        // but 0 is a good guess.
-        buf->s.start = 0;
-        last_scr_pts = buf->s.start;
+        // We don't really know what it's timestamp should be.
+        // So drop the buffer.
+        hb_buffer_close(&buf);
+        return 0;
     }
     if (buf->s.stop != AV_NOPTS_VALUE)
     {