Ticket #99 (new enhancement)
Autodetect audio device sample rate
| Reported by: | adigeo | Owned by: | support@ag-projects.com |
|---|---|---|---|
| Priority: | major | Milestone: | 3rd |
| Component: | Audio | Version: | trunk |
| Keywords: | Cc: |
Description
- Open audio device at their native sample rate
- Remove sample rate setting
Attachments
Change History
comment:2 Changed 17 months ago by adigeo
Open sound device at native sample rate
Design notes
- Offer information about how the default sound device is determined from portaudio up to the middleware (see attached file)
- Open a pjmedia conference bridge (SIPSIMPLE core AudioMixer object) at the lowest sample rate of the input and output devices and if that fails try known values in turn (48, 44.1. 32, 16, 8k); if that still fails, raise an exception which specifies whether the input or output device opening failed. Make use of the error in SIPApplication to revert to system_default and then the dummy device
- Since the pjmedia conference bridge is limited by design to one sample rate once created, changing the audio device might fail and the only option would be to create a new conference bridge. This means that all low-level objects bound to a mixer need to be recreated (WaveFile, RecordingWaveFile, AudioTransport). The only problem is the RecordingWaveFile, since a new object will not be able to continue writing to the same file. There is no obvious workaround for this.
- Proposed high-level audio API:
- High-level IAudioPort objects: WavePlayer, WaveRecorder, AudioStream (already implemented)
- IAudioPort objects should not be bound to an AudioMixer at creation
- All IAudioPort objects keep track of the number of AudioBridges they are part of
- Once added to an AudioBridge, an IAudioPort will be bound to the AudioMixer of the AudioBridge if it is not part of any other AudioBridge, or if it is already bound to the same AudioMixer
- The physical audio device will be changed by instructing the RootAudioBridge to do so. If a new AudioMixer will need to be recreated, all the IAudioPorts part of the bridge will be rebound if they are not part of any other AudioBridge. If they are, they will be eliminated from this bridge (?).
- As AudioBridges can contain other AudioBridges, the change is propagated down the chain
- There are RootAudioBridges outside those kept by the Application. The Application needs to know of them and change their physical audio device as well. The application should have a means of registering RootAudioBridges of two types: for voice and alerts.
- The AudioStream needs to create an AudioTransport which needs to be bound to an AudioMixer (because it uses the AudioTransport for the SDP negotiation). Therefore, the AudioStream would need to create an AudioTransport initially bound to an AudioMixer over the dummy device and recreate it later. A bigger issue appears if, for example, an AudioStream negotiated speex at 32kHz, but is then assigned an audio mixer opened at 16kHz.
- Remove audio.sample_rate setting
Changed 17 months ago by adigeo
-
attachment
pjsip-2830-pjmedia_get_default_device_functions.patch
added
Patch for pjmedia which adds two functions for getting the id of the default sound device
Note: See
TracTickets for help on using
tickets.
