forked from Green-Sky/tomato
Merge commit 'a3126d581b6a872f0b8d5641f199fb233306e181'
This commit is contained in:
5
external/toxcore/c-toxcore/toxav/BUILD.bazel
vendored
5
external/toxcore/c-toxcore/toxav/BUILD.bazel
vendored
@ -54,6 +54,7 @@ cc_library(
|
||||
"//c-toxcore/toxcore:ccompat",
|
||||
"//c-toxcore/toxcore:logger",
|
||||
"//c-toxcore/toxcore:mono_time",
|
||||
"//c-toxcore/toxcore:tox",
|
||||
"//c-toxcore/toxcore:util",
|
||||
],
|
||||
)
|
||||
@ -68,6 +69,7 @@ cc_library(
|
||||
"//c-toxcore/toxcore:ccompat",
|
||||
"//c-toxcore/toxcore:logger",
|
||||
"//c-toxcore/toxcore:mono_time",
|
||||
"//c-toxcore/toxcore:tox",
|
||||
"//c-toxcore/toxcore:util",
|
||||
],
|
||||
)
|
||||
@ -94,6 +96,7 @@ cc_library(
|
||||
"//c-toxcore/toxcore:ccompat",
|
||||
"//c-toxcore/toxcore:logger",
|
||||
"//c-toxcore/toxcore:mono_time",
|
||||
"//c-toxcore/toxcore:util",
|
||||
"@opus",
|
||||
],
|
||||
)
|
||||
@ -113,6 +116,7 @@ cc_library(
|
||||
":public_api",
|
||||
":ring_buffer",
|
||||
":rtp",
|
||||
"//c-toxcore/toxcore:Messenger",
|
||||
"//c-toxcore/toxcore:ccompat",
|
||||
"//c-toxcore/toxcore:logger",
|
||||
"//c-toxcore/toxcore:mono_time",
|
||||
@ -129,6 +133,7 @@ cc_library(
|
||||
deps = [
|
||||
"//c-toxcore/toxcore",
|
||||
"//c-toxcore/toxcore:ccompat",
|
||||
"//c-toxcore/toxcore:group",
|
||||
"//c-toxcore/toxcore:logger",
|
||||
"//c-toxcore/toxcore:mono_time",
|
||||
"//c-toxcore/toxcore:tox",
|
||||
|
2
external/toxcore/c-toxcore/toxav/groupav.c
vendored
2
external/toxcore/c-toxcore/toxav/groupav.c
vendored
@ -536,7 +536,7 @@ bool groupchat_av_enabled(const Group_Chats *g_c, uint32_t groupnumber)
|
||||
*/
|
||||
int add_av_groupchat(const Logger *log, Tox *tox, Group_Chats *g_c, audio_data_cb *audio_callback, void *userdata)
|
||||
{
|
||||
const int groupnumber = add_groupchat(g_c, &tox->rng, GROUPCHAT_TYPE_AV);
|
||||
const int groupnumber = add_groupchat(g_c, tox->sys.rng, GROUPCHAT_TYPE_AV);
|
||||
|
||||
if (groupnumber == -1) {
|
||||
return -1;
|
||||
|
4
external/toxcore/c-toxcore/toxav/toxav.c
vendored
4
external/toxcore/c-toxcore/toxav/toxav.c
vendored
@ -181,7 +181,7 @@ ToxAV *toxav_new(Tox *tox, Toxav_Err_New *error)
|
||||
|
||||
av->tox = tox;
|
||||
av->m = m;
|
||||
av->toxav_mono_time = mono_time_new(nullptr, nullptr);
|
||||
av->toxav_mono_time = mono_time_new(tox->sys.mem, nullptr, nullptr);
|
||||
av->msi = msi_new(av->m);
|
||||
|
||||
if (av->msi == nullptr) {
|
||||
@ -239,7 +239,7 @@ void toxav_kill(ToxAV *av)
|
||||
}
|
||||
}
|
||||
|
||||
mono_time_free(av->toxav_mono_time);
|
||||
mono_time_free(av->tox->sys.mem, av->toxav_mono_time);
|
||||
|
||||
pthread_mutex_unlock(av->mutex);
|
||||
pthread_mutex_destroy(av->mutex);
|
||||
|
41
external/toxcore/c-toxcore/toxav/toxav_old.c
vendored
41
external/toxcore/c-toxcore/toxav/toxav_old.c
vendored
@ -16,64 +16,23 @@ int toxav_add_av_groupchat(Tox *tox, audio_data_cb *audio_callback, void *userda
|
||||
return add_av_groupchat(tox->m->log, tox, tox->m->conferences_object, audio_callback, userdata);
|
||||
}
|
||||
|
||||
/** @brief Join a AV group (you need to have been invited first).
|
||||
*
|
||||
* @return group number on success.
|
||||
* @retval -1 on failure.
|
||||
*
|
||||
* Note that total size of pcm in bytes is equal to `samples * channels * sizeof(int16_t)`.
|
||||
*/
|
||||
int toxav_join_av_groupchat(Tox *tox, uint32_t friendnumber, const uint8_t *data, uint16_t length,
|
||||
audio_data_cb *audio_callback, void *userdata)
|
||||
{
|
||||
return join_av_groupchat(tox->m->log, tox, tox->m->conferences_object, friendnumber, data, length, audio_callback, userdata);
|
||||
}
|
||||
|
||||
/** @brief Send audio to the group chat.
|
||||
*
|
||||
* @retval 0 on success.
|
||||
* @retval -1 on failure.
|
||||
*
|
||||
* Note that total size of pcm in bytes is equal to `samples * channels * sizeof(int16_t)`.
|
||||
*
|
||||
* Valid number of samples are `(sample rate) * (audio length) / 1000`
|
||||
* (Valid values for audio length are: 2.5, 5, 10, 20, 40 or 60 ms)
|
||||
* Valid number of channels are 1 or 2.
|
||||
* Valid sample rates are 8000, 12000, 16000, 24000, or 48000.
|
||||
*
|
||||
* Recommended values are: samples = 960, channels = 1, sample_rate = 48000
|
||||
*/
|
||||
int toxav_group_send_audio(Tox *tox, uint32_t groupnumber, const int16_t *pcm, unsigned int samples, uint8_t channels,
|
||||
uint32_t sample_rate)
|
||||
{
|
||||
return group_send_audio(tox->m->conferences_object, groupnumber, pcm, samples, channels, sample_rate);
|
||||
}
|
||||
|
||||
/** @brief Enable A/V in a groupchat.
|
||||
*
|
||||
* A/V must be enabled on a groupchat for audio to be sent to it and for
|
||||
* received audio to be handled.
|
||||
*
|
||||
* An A/V group created with `toxav_add_av_groupchat` or `toxav_join_av_groupchat`
|
||||
* will start with A/V enabled.
|
||||
*
|
||||
* An A/V group loaded from a savefile will start with A/V disabled.
|
||||
*
|
||||
* @retval 0 on success.
|
||||
* @retval -1 on failure.
|
||||
*
|
||||
* Note that total size of pcm in bytes is equal to `samples * channels * sizeof(int16_t)`.
|
||||
*/
|
||||
int toxav_groupchat_enable_av(Tox *tox, uint32_t groupnumber, audio_data_cb *audio_callback, void *userdata)
|
||||
{
|
||||
return groupchat_enable_av(tox->m->log, tox, tox->m->conferences_object, groupnumber, audio_callback, userdata);
|
||||
}
|
||||
|
||||
/** @brief Disable A/V in a groupchat.
|
||||
*
|
||||
* @retval 0 on success.
|
||||
* @retval -1 on failure.
|
||||
*/
|
||||
int toxav_groupchat_disable_av(Tox *tox, uint32_t groupnumber)
|
||||
{
|
||||
return groupchat_disable_av(tox->m->conferences_object, groupnumber);
|
||||
|
Reference in New Issue
Block a user