Opened 17 years ago
Last modified 17 years ago
#438 closed enhancement
Workaround for frame bursts from audio devices — at Version 1
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | critical | Milestone: | release-0.9.0 |
Component: | pjmedia | Version: | trunk |
Keywords: | Cc: | nanang | |
Backport to 1.x milestone: | Backported: |
Description (last modified by bennylp)
Most audio devices will call record and playback callbacks in burst, rather than in perfect interleave (for example, burst of record callbacks, followed by burst of playback callbacks, and so on). Because of this, audio buffering needs to be implemented in few pjmedia components (conference bridge, splitcomb, echo canceller, etc.), and the maximum buffering is controlled by PJMEDIA_SOUND_BUFFER_COUNT macro.
This is not ideal, because:
- it adds audio latency of up to PJMEDIA_SOUND_BUFFER_COUNT frames, while theoretically the delay should be limited to the maximum burst level of the device.
- it will add even more end to end latency when the sound device is connected directly to the stream (rather than via conference bridge), because of how the jitter buffer is implemented.
- pjmedia components need to handle the burst, while this problem should have been localized and fixed in sound device.
This ticket attempts to fix this problem by fixing the burst in sound device port. The idea is sound device port will apply a fixed delay to buffer the burst, like a fixed jitter buffer (and the delay will be detected at run-time) and will call the get_frame() and put_frame() callback in a perfect interleave. Then we could remove the PJMEDIA_SOUND_BUFFER_COUNT macro.
In r1664: