Description: handle transport sync errors arising from libfdk-aac
 GStreamer can successfully play an .m4a file that ffplay cannot, albeit
 with some audible glitching. GStreamer handles the AAC_DEC_TRANSPORT_SYNC_ERROR
 (see https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/fdkaac/gstfdkaacdec.c#n214)
 but libavcodec does not. It is documented that the input buffer should
 be discarded in this case, but decoding not stopped, so we attempt
 to do this in order to make decoding more robust.
 (see https://github.com/esrlabs/fdk-aac/blob/master/libAACdec/include/aacdecoder_lib.h#L362)
Author: Robert McQueen <rob@endlessm.com>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: vendor
Bug: https://phabricator.endlessm.com/T23374
Last-Update: 2018-07-27

--- ffmpeg-3.2.11.orig/libavcodec/libfdk-aacdec.c
+++ ffmpeg-3.2.11/libavcodec/libfdk-aacdec.c
@@ -326,7 +326,7 @@ static int fdk_aac_decode_frame(AVCodecC
     }
 
     err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size / sizeof(INT_PCM), 0);
-    if (err == AAC_DEC_NOT_ENOUGH_BITS) {
+    if (err == AAC_DEC_NOT_ENOUGH_BITS || err == AAC_DEC_TRANSPORT_SYNC_ERROR) {
         ret = avpkt->size - valid;
         goto end;
     }
