TokTok / c-toxcore

The future of online communications.
https://tox.chat
GNU General Public License v3.0
2.27k stars 285 forks source link

Change the group A/V API from Tox to ToxAV #1364

Open sudden6 opened 4 years ago

sudden6 commented 4 years ago

Currently groups with AV enabled are decoding the audio in the Tox main thread. This is done here. This also means that the callbacks for groupAV are emitted from the main thread, potentially causing confusion for the client developers.

Ideally we would do the decoding in the dedicated ToxAV thread to keep the protocol and other events running smoothly even under heavy decoding load/many parallel calls. This will also fix the inconsistency of emitting AV callbacks from the main and the ToxAV thread.

Unfortunately this requires an API break since all functions below this line take a Tox struct as parameter and we don't have access to the ToxAV struct. Access to the ToxAV struct is needed, because we need a lock when queuing packets for decoding and a queue which toxav_iterate(...) can access.

Diadlo commented 4 years ago

To avoid an API break we can just add new functions with correct API and mark old one as deprecated

sudden6 commented 4 years ago

Right, I didn't really think of that.