[FFmpeg-trac] #11398(avdevice:new): "avfoundation" audio capture had missing samples randomly

FFmpeg trac at avcodec.org
Sun Jan 5 18:22:31 EET 2025


#11398: "avfoundation" audio capture had missing samples randomly
--------------------------------------+------------------------------------
             Reporter:  drobinson     |                    Owner:  (none)
                 Type:  defect        |                   Status:  new
             Priority:  normal        |                Component:  avdevice
              Version:  7.1           |               Resolution:
             Keywords:  avfoundation  |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  1             |
--------------------------------------+------------------------------------
Comment (by drobinson):

 I had a chance to do some more investigation.

 It seems like the issue is related to
 `captureOutput:didOutputSampleBuffer:fromConnection` callback in the
 `AVFAudioReceiver` class being called before the `avf_read_packet`
 function and freeing/overwriting the `current_audio_frame` before it is
 read.

 I am able to avoid the dropouts by creating a FIFO for the received
 frames.

 Not being that familiar with this codebase or AVFoundation, I am not sure
 if this is a reasonable fix or not (I suppose there could be
 latency/alignment fallout), but the avfoundation_audio_fifo.patch attached
 patch seems to resolve the issue for me.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11398#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list