[FFmpeg-devel] avcodec/dca: set initial sample_fmt to FLTP

Submitted by foo86 on Dec. 24, 2016, 6:19 p.m.

Details

Message ID 20161224181917.20315-1-foobaz86@gmail.com
State New
Headers show

Commit Message

foo86 Dec. 24, 2016, 6:19 p.m.
Fixes regression introduced in 39f7620d76c7a133535ed7a535f7a74fefa6e435.

Not setting default sample_fmt can result in failed transcode when audio
stream starts later in a file.

Set initial sample_fmt to FLTP, which is the "baseline" format decoder
produces.

Fixes ticket #5998.
---
 libavcodec/dcadec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Hendrik Leppkes Dec. 24, 2016, 8:49 p.m.
Am 24.12.2016 21:17 schrieb "foo86" <foobaz86@gmail.com>:

Fixes regression introduced in 39f7620d76c7a133535ed7a535f7a74fefa6e435.

Not setting default sample_fmt can result in failed transcode when audio
stream starts later in a file.


I don't agree with this.


Letting decoders set their output format based on stream data is standard
behavior and we have options to increase to probe size and analyze duration
to accommodate badly muxed files.

Having the wrong sample format can result in different awkwardness, instead
of waiting until we have a correct one, especially with recent approaches
to limit stream parsing as much as possible, where it might not even try to
fix it anymore during probing.

Maybe FFmpeg should be fixed to just assume whatever standard sample format
if none is set and insert a converter if needed then.

- Hendrik

Patch hide | download patch | download mbox

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 4146a85ec5..f772406691 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -362,6 +362,8 @@  static av_cold int dcadec_init(AVCodecContext *avctx)
         break;
     }
 
+    avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+
     return 0;
 }