File: 0002-fdkaacdec-Do-not-report-decoding-error-for-flush-req.patch

package info (click to toggle)
gst-plugins-bad1.0-contrib 1.20.0-1.1
  • links: PTS, VCS
  • area: contrib
  • in suites: sid, trixie
  • size: 59,548 kB
  • sloc: ansic: 609,893; cpp: 97,160; objc: 3,569; xml: 3,351; sh: 1,035; python: 206; makefile: 91; java: 75
file content (38 lines) | stat: -rw-r--r-- 1,592 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From b949c5c92c940e338a8086016da03ae6dbc5ba50 Mon Sep 17 00:00:00 2001
From: Sanchayan Maity <sanchayan@asymptotic.io>
Date: Thu, 26 Nov 2020 19:23:11 +0530
Subject: [PATCH 2/7] fdkaacdec: Do not report decoding error for flush request

A flush request is done when set_format is called to empty internal bit
buffer maintained by fdk-aac. When this happens, during the explicit
call to handle_buffer, decodeFrame does not return a AAC_DEC_OK. This
gets reported as a decoding error while no decoding error in fact took
place. Since this can be confusing, just return a GST_FLOW_OK and log
that an explicit flush was requested.
---
 ext/fdkaac/gstfdkaacdec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ext/fdkaac/gstfdkaacdec.c b/ext/fdkaac/gstfdkaacdec.c
index ed060a908c..7ecfd872fa 100644
--- a/ext/fdkaac/gstfdkaacdec.c
+++ b/ext/fdkaac/gstfdkaacdec.c
@@ -237,6 +237,15 @@ gst_fdkaacdec_handle_frame (GstAudioDecoder * dec, GstBuffer * inbuf)
     ret = GST_FLOW_OK;
     outbuf = NULL;
     goto finish;
+  } else if ((err != AAC_DEC_OK) && (flags & AACDEC_FLUSH)) {
+    /*
+     * A flush/drain was requested when set_format got called. When a flush
+     * gets requested, aacDecoder_DecodeFrame may not return AAC_DEC_OK. Do
+     * not report a decoding error with GST_AUDIO_DECODER_ERROR for this case.
+     */
+    GST_LOG_OBJECT (self, "Decoder flush was requested");
+    ret = GST_FLOW_OK;
+    goto out;
   } else if (err != AAC_DEC_OK) {
     GST_AUDIO_DECODER_ERROR (self, 1, STREAM, DECODE, (NULL),
         ("decoding error: %d", err), ret);
-- 
2.34.1