Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / thirdparty / src / ffmpeg-5.1.patchC
1 --- a/libavcodec/encode.c
2 +++ b/libavcodec/encode.c
3 @@ -191,7 +191,7 @@
4      }
5  
6      if (!frame->buf[0]) {
7 -        if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY ||
8 +        if (avci->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY ||
9                (avci->frame_thread_encoder && avctx->active_thread_type & FF_THREAD_FRAME)))
10              return AVERROR_EOF;
11  
12 @@ -243,8 +243,10 @@
13          avpkt->flags |= avci->intra_only_flag;
14      }
15  
16 -    if (avci->draining && !got_packet)
17 +    if (avci->draining && !got_packet) {
18 +       fflush(stderr);
19          avci->draining_done = 1;
20 +    }
21  
22  end:
23      if (ret < 0 || !got_packet)
24 @@ -365,10 +367,16 @@
25      if (avci->draining)
26          return AVERROR_EOF;
27  
28 -    if (avci->buffer_frame->buf[0])
29 +    if (avci->buffer_frame->buf[0]) {
30 +        if (!frame) {
31 +           fflush(stderr);
32 +            av_frame_unref(avci->buffer_frame);
33 +       }
34          return AVERROR(EAGAIN);
35 +    }
36  
37      if (!frame) {
38 +       fflush(stderr);
39          avci->draining = 1;
40      } else {
41          ret = encode_send_frame_internal(avctx, frame);