summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2013-01-02 21:23:02 +0000
committerjstebbins <[email protected]>2013-01-02 21:23:02 +0000
commit036e9b30ce75ebe78ad8c6e4ce5de7cf6c12777f (patch)
tree8e1d04abe7e0f035a159e9c4622202e45e80a188 /contrib
parent84b4d057e2af8b185050b2e6c86160748d48d547 (diff)
libav patch: fix dts audio bitstream desync when frame size changes
Fixes https://forum.handbrake.fr/viewtopic.php?f=11&t=26016&hilit=squid git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5133 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ffmpeg/A05-dca-resync.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A05-dca-resync.patch b/contrib/ffmpeg/A05-dca-resync.patch
new file mode 100644
index 000000000..edc2e76fa
--- /dev/null
+++ b/contrib/ffmpeg/A05-dca-resync.patch
@@ -0,0 +1,37 @@
+From 280e670dd039d7ba628bc47f1cdee72df9658094 Mon Sep 17 00:00:00 2001
+From: John Stebbins <[email protected]>
+Date: Wed, 2 Jan 2013 11:32:40 -0800
+Subject: [PATCH] dca_parser: Handle loss of bitstream sync better
+
+A change in framesize caused a perpetual loss of synchronization. So
+when the sync pattern is not found where it is expected, reset and
+recalculate the framesize.
+---
+ libavcodec/dca_parser.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
+index ab235cf..ad441f8 100644
+--- a/libavcodec/dca_parser.c
++++ b/libavcodec/dca_parser.c
+@@ -88,6 +88,17 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
+ pc1->size = 0;
+ return i - 3;
+ }
++ else if (pc1->size == pc1->framesize)
++ {
++ // Lost sync, search for sync and reset framesize as it may
++ // have changed mid-stream
++ pc->frame_start_found = 0;
++ pc->state = -1;
++ pc1->size = 0;
++ pc1->framesize = 0;
++ pc1->lastmarker = 0;
++ return END_NOT_FOUND;
++ }
+ }
+ }
+ pc->frame_start_found = start_found;
+--
+1.7.11.7
+