[FFmpeg-devel] [PATCH v2] avdevice/avfoundation: continue to try get packet if not in observed_quit mode

Steven Liu lq at chinaffmpeg.org
Sat Sep 18 04:51:37 EEST 2021


Test environment:
Darwin liuqi05.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
Big Sur 11.4 (20F71)
before patch:
./ffmpeg -f avfoundation -i ":0" -y out.wav
say something to microphone
ffplay out.wav will get noise.
look the into the code, it will return EAGAIN when
transport control observation is not ctx->observed_quit.

after patch:
./ffmpeg -f avfoundation -i ":0" -y out.wav
say something to microphone
ffplay out.wav will ok.

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavdevice/avfoundation.m | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 0cd6e646d5..cd30f48cfe 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -1186,8 +1186,6 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt)
             unlock_frames(ctx);
             if (ctx->observed_quit) {
                 return AVERROR_EOF;
-            } else {
-                return AVERROR(EAGAIN);
             }
         }
 
-- 
2.25.0



More information about the ffmpeg-devel mailing list