Message ID | 20230414164244.15264-1-anton@khirnov.net |
---|---|
State | Accepted |
Commit | e392674399e19c104e5b13f37440facd7f3dcd6c |
Headers | show |
Series | [FFmpeg-devel,1/7] lavfi: ensure audio frame durations match the sample count | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Anton Khirnov (12023-04-14): > --- > libavfilter/avfilter.c | 8 ++++++++ > 1 file changed, 8 insertions(+) No objection, but once again we see that duration field was a bad idea.
Quoting Nicolas George (2023-04-17 09:33:46) > Anton Khirnov (12023-04-14): > > --- > > libavfilter/avfilter.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > No objection, Thank you, will push set tomorrow if nobody has further comments. > but once again we see that duration field was a bad idea. As patch 7/7 shows, it can be useful even for audio.
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 8d5702a0c8..d2e9ba47ef 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -997,6 +997,14 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) av_log(link->dst, AV_LOG_ERROR, "Sample rate change is not supported\n"); goto error; } + + frame->duration = av_rescale_q(frame->nb_samples, (AVRational){ 1, frame->sample_rate }, + link->time_base); +#if FF_API_PKT_DURATION +FF_DISABLE_DEPRECATION_WARNINGS + frame->pkt_duration = frame->duration; +FF_ENABLE_DEPRECATION_WARNINGS +#endif } link->frame_blocked_in = link->frame_wanted_out = 0;