From 036e9b30ce75ebe78ad8c6e4ce5de7cf6c12777f Mon Sep 17 00:00:00 2001 From: jstebbins Date: Wed, 2 Jan 2013 21:23:02 +0000 Subject: 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 --- contrib/ffmpeg/A05-dca-resync.patch | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 contrib/ffmpeg/A05-dca-resync.patch (limited to 'contrib') 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 +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 + -- cgit v1.2.3