InterCom is a low-latency full-duplex intercom(municator) designed for the transmission of media (audio and video) between networked users.
InterCom is written in Python and uses the python-soundevice
package. InterCom implements the following steps:
- Read raw data from the audio ADC.
- Encode the raw data.
- Send the encoded data to the interlocutor.
- Receive encoded data from the interlocutor.
- Decode the encoded data.
- Write the raw data to the audio DAC.
The Steps 2 and 4 are CPU bound (the rest are IO bound). For this reason, Intercom runs two parallel tasks:
- CES (Capture Encode and Send), which samples, process and sends the media (currently only audio) towards an Internet end-point.
- RDP (Receive Decode and Play), that receives the media, decodes and plays it.
CES (Steps 1, 2 and 3) and RDP (Steps 4, 5, and 6) are run in two different processes, which share information about the data-flow control that CES must perform. A further multiprocessing decomposition could be performed in E (Encode) and D (Decode) steps.
Host A Host B
+---------+ +---------+
| CES |----->| RDP |
|---------| |---------|
| RDP |<-----| CES |
+---------+ +---------+
Each host runs a instance of InterCom.
Host A Host B
+---------+ +---------+
| CES |------>| RDP |
|---------| |---------|
| RDP |<------| CES |
+---------+ +---------+
+---------+ +---------+
+--| CES | +->| RDP |
| |---------| | |---------|
| | RDP |<-+ | | CES |--+
| +---------+ | | +---------+ |
| +------+ +------+ |
| | +---------+ | |
| +--| CES | | |
| |---------| | |
+---------->| RDP | | |
+---------+ | |
+---------+ | |
| CES |--+ |
|---------| |
| RDP |<----------+
+---------+
Host C
Each host runs two instances of InterCom.