Message ID | 20210918015137.18968-1-lq@chinaffmpeg.org |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v2] avdevice/avfoundation: continue to try get packet if not in observed_quit mode | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
Hi, On 18 Sep 2021, at 3:51, Steven Liu wrote: > Signed-off-by: Steven Liu <lq@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) > Did you retest? On my Mac (10.10.5), current HEAD works fine with audio from the mic. Your patch introduces more errors for me: Thilo-Borgmanns-MacBook-Pro-2:FFmpeg Thilo$ ./ffmpeg -f avfoundation -list_devices 0 -i ":0" -y out_post.mp4 ffmpeg version N-103788-g0a51973 Copyright (c) 2000-2021 the FFmpeg developers built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) configuration: --disable-videotoolbox libavutil 57. 6.100 / 57. 6.100 libavcodec 59. 9.100 / 59. 9.100 libavformat 59. 5.100 / 59. 5.100 libavdevice 59. 0.101 / 59. 0.101 libavfilter 8. 9.100 / 8. 9.100 libswscale 6. 1.100 / 6. 1.100 libswresample 4. 0.100 / 4. 0.100 Input #0, avfoundation, from ':0': Duration: N/A, start: 216642.184694, bitrate: 2822 kb/s Stream #0:0: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_f32le (native) -> aac (native)) Press [q] to stop, [?] for help Output #0, mp4, to 'out_post.mp4': Metadata: encoder : Lavf59.5.100 Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc59.9.100 aac Illegal instruction: 40:00:00.00 bitrate=N/A speed= 0x Thilo-Borgmanns-MacBook-Pro-2:FFmpeg Thilo$ ./ffmpeg -f avfoundation -list_devices 0 -i ":0" -y out_post.mp4 ffmpeg version N-103788-g0a51973 Copyright (c) 2000-2021 the FFmpeg developers built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) configuration: --disable-videotoolbox libavutil 57. 6.100 / 57. 6.100 libavcodec 59. 9.100 / 59. 9.100 libavformat 59. 5.100 / 59. 5.100 libavdevice 59. 0.101 / 59. 0.101 libavfilter 8. 9.100 / 8. 9.100 libswscale 6. 1.100 / 6. 1.100 libswresample 4. 0.100 / 4. 0.100 Input #0, avfoundation, from ':0': Duration: N/A, start: 216651.490091, bitrate: 2822 kb/s Stream #0:0: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_f32le (native) -> aac (native)) Press [q] to stop, [?] for help Output #0, mp4, to 'out_post.mp4': Metadata: encoder : Lavf59.5.100 Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc59.9.100 aac 2021-09-22 13:05:36.347 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497a80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.358 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569b30 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.370 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c15697f0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.381 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c15697f0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.393 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569990 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.404 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1498310 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.416 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569990 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.428 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497de0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.439 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497f80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.451 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497f80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.462 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497f80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.474 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.486 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.498 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569990 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.509 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c15697f0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.520 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.532 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.544 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569fd0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.555 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.567 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.579 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> 2021-09-22 13:05:36.590 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569fd0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff -Thilo
> 2021年9月22日 下午7:09,Thilo Borgmann <thilo.borgmann@mail.de> 写道: > > Hi, > > > On 18 Sep 2021, at 3:51, Steven Liu wrote: > >> Signed-off-by: Steven Liu <lq@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) >> > > Did you retest? Hi Thilo, Sure, Samples of voice from microphone AVFoundation: http://bbs.chinaffmpeg.com/before_patch.wav http://bbs.chinaffmpeg.com/after_patch.wav Maybe need macro to control the workflow? My Mac(11.6 (20G165)) > On my Mac (10.10.5), current HEAD works fine with audio from the mic. Your patch introduces more errors for me: > > Thilo-Borgmanns-MacBook-Pro-2:FFmpeg Thilo$ ./ffmpeg -f avfoundation -list_devices 0 -i ":0" -y out_post.mp4 > ffmpeg version N-103788-g0a51973 Copyright (c) 2000-2021 the FFmpeg developers > built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) > configuration: --disable-videotoolbox > libavutil 57. 6.100 / 57. 6.100 > libavcodec 59. 9.100 / 59. 9.100 > libavformat 59. 5.100 / 59. 5.100 > libavdevice 59. 0.101 / 59. 0.101 > libavfilter 8. 9.100 / 8. 9.100 > libswscale 6. 1.100 / 6. 1.100 > libswresample 4. 0.100 / 4. 0.100 > Input #0, avfoundation, from ':0': > Duration: N/A, start: 216642.184694, bitrate: 2822 kb/s > Stream #0:0: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s > Stream mapping: > Stream #0:0 -> #0:0 (pcm_f32le (native) -> aac (native)) > Press [q] to stop, [?] for help > Output #0, mp4, to 'out_post.mp4': > Metadata: > encoder : Lavf59.5.100 > Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s > Metadata: > encoder : Lavc59.9.100 aac > Illegal instruction: 40:00:00.00 bitrate=N/A speed= 0x > > Thilo-Borgmanns-MacBook-Pro-2:FFmpeg Thilo$ ./ffmpeg -f avfoundation -list_devices 0 -i ":0" -y out_post.mp4 > ffmpeg version N-103788-g0a51973 Copyright (c) 2000-2021 the FFmpeg developers > built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) > configuration: --disable-videotoolbox > libavutil 57. 6.100 / 57. 6.100 > libavcodec 59. 9.100 / 59. 9.100 > libavformat 59. 5.100 / 59. 5.100 > libavdevice 59. 0.101 / 59. 0.101 > libavfilter 8. 9.100 / 8. 9.100 > libswscale 6. 1.100 / 6. 1.100 > libswresample 4. 0.100 / 4. 0.100 > Input #0, avfoundation, from ':0': > Duration: N/A, start: 216651.490091, bitrate: 2822 kb/s > Stream #0:0: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s > Stream mapping: > Stream #0:0 -> #0:0 (pcm_f32le (native) -> aac (native)) > Press [q] to stop, [?] for help > Output #0, mp4, to 'out_post.mp4': > Metadata: > encoder : Lavf59.5.100 > Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s > Metadata: > encoder : Lavc59.9.100 aac > 2021-09-22 13:05:36.347 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497a80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.358 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569b30 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.370 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c15697f0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.381 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c15697f0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.393 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569990 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.404 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1498310 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.416 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569990 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.428 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497de0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.439 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497f80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.451 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497f80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.462 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497f80 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.474 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.486 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.498 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569990 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.509 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c15697f0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.520 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.532 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.544 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569fd0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.555 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.567 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.579 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1497800 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff3c1539130 [type:soun][enabled:1][active:1]> > 2021-09-22 13:05:36.590 ffmpeg[80494:2018762] Dropping audio sample buffer 0x7ff3c1569fd0 for output <AVCaptureAudioDataOutput: 0x7ff3c1536cb0> connection <AVCaptureConnection: 0x7ff > > > -Thilo > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > Thanks Steven Liu
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); } }
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@chinaffmpeg.org> --- libavdevice/avfoundation.m | 2 -- 1 file changed, 2 deletions(-)