[Tox Support] Tox Audio Send and Recieve Advice ?

Zetok Zalbavar zetok at openmailbox.org
Thu Dec 8 18:10:38 UTC 2016


On 08.12.2016 17:57, Nocs ... wrote:
> I get always this cause is inside the loop until i exit after the call is answered by the other client which uses the same send and recieve functions as this
> 
> both clients outputs this error in the send function
> 
> <http://aka.ms/weboutlook>OXAV_ERR_SEND_FRAME_INVALID
> 
> printf("Audio Parameteres Invalid !\n");
> 

https://github.com/TokTok/c-toxcore/blob/d8ae726d0a332c74da7bbed70982367dd01899e1/toxav/toxav.h#L592,L596

Have you tried using values for that stuff that are listed in the toxav.h?


> From: Support <support-bounces at lists.tox.chat> on behalf of Zetok Zalbavar <zetok at openmailbox.org>
> Sent: Thursday, December 8, 2016 7:38:30 PM
> To: support at lists.tox.chat
> Subject: Re: [Tox Support] Tox Audio Send and Recieve Advice ?
> 
> On 08.12.2016 17:29, Nocs ... wrote:
>> Hello to all again,
>>
>>
>> I am trying to send audio through tox with portaudio and opus encoding, i test them both in local and has good quality
>>
>> and i try to send the appropiate variables through toxav_audio_send_frame() but it returns the TOXAV_ERR_SEND_FRAME_INVALID error all the time.
>>
>> Can anyone give a hand what variables to place inside the toxav_audio_send_frame() function ?
>>
>>
>> This code is portaudio and opus for local tests working good :
>>
>> // initialize opus
>> encr = opus_encoder_create(TestSampleRate, TestChannels, OPUS_APPLICATION_AUDIO, NULL);
>> decr = opus_decoder_create(TestSampleRate, TestChannels, NULL);
>>
>> while (connected){
>>     //// With Opus Encoding - Decoding
>>     Pa_ReadStream(TestStream, captured.data(), TestBufferSize);
>>     enc_bytes = opus_encode(encr, reinterpret_cast<opus_int16 const*>(captured.data()), TestBufferSize, reinterpret_cast<opus_uint8*>(encoded.data()), encoded.size());
>>
>>     dec_bytes = opus_decode(decr, reinterpret_cast<opus_uint8*>(encoded.data()), enc_bytes, reinterpret_cast<opus_int16*>(decoded.data()), TestBufferSize, 0);
>>     Pa_WriteStream(TestStream, decoded.data(), TestBufferSize);
>> }
>>
>>
>> And here in this code i try to recieve and send with the above code through Tox but cant make it cause of wrong parameters :
>> // initialize opus
>> encr = opus_encoder_create(TestSampleRate, TestChannels, OPUS_APPLICATION_AUDIO, NULL);
>> decr = opus_decoder_create(TestSampleRate, TestChannels, NULL);
>>
>> ////// SEND AUDIO FRAME
>> while (connected){
>>     //// With Opus Encoding
>>     Pa_ReadStream(TestStream, captured.data(), TestBufferSize);
>>     enc_bytes = opus_encode(encr, reinterpret_cast<opus_int16 const*>(captured.data()), TestBufferSize, reinterpret_cast<opus_uint8*>(encoded.data()), encoded.size());
>>
>>     size_t SampleCounter = ((TestSampleRate)* (enc_bytes) / 1000);
>>     TOXAV_ERR_SEND_FRAME SendAudioError;
>>     toxav_audio_send_frame(avtox, FriendID, reinterpret_cast<int16_t*>(encoded.data()), SampleCounter, (uint8_t)TestChannels, (uint32_t)TestSampleRate, &SendAudioError);
>>     switch (SendAudioError) {
>>         case TOXAV_ERR_SEND_FRAME_OK:
>>             printf("Audio Frame Sended OK \n");
>>             break;
>>         case TOXAV_ERR_SEND_FRAME_NULL:
>>             printf("The Audio Samples were NULL !\n");
>>             break;
>>         case TOXAV_ERR_SEND_FRAME_FRIEND_NOT_FOUND:
>>             printf("Audio Send Friend not Found !\n");
>>             break;
>>         case TOXAV_ERR_SEND_FRAME_FRIEND_NOT_IN_CALL:
>>             printf("Friend Not In Audio Call with You !\n");
>>             break;
>>         case TOXAV_ERR_SEND_FRAME_SYNC:
>>             printf("Audio Syncronization Failed !\n");
>>             break;
>>         case TOXAV_ERR_SEND_FRAME_INVALID:
>>             printf("Audio Parameteres Invalid !\n");
>>             break;
>>         case TOXAV_ERR_SEND_FRAME_PAYLOAD_TYPE_DISABLED:
>>             printf("Audio Disabled By Friend or You !\n");
>>             break;
>>         case TOXAV_ERR_SEND_FRAME_RTP_FAILED:
>>             printf("Audio Failed To Send Frame !\n");
>>             break;
>>     }
>>     Pa_Sleep(1000);
>> }
>>
>> ////// RECIEVE AUDIO FRAME
>> static void t_toxav_receive_audio_frame_cb(ToxAV *av, uint32_t friend_number, int16_t const *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate, void *user_data){
>>
>>     dec_bytes = opus_decode(decr, reinterpret_cast<opus_uint8*>(&pcm), (opus_int32)sample_count, reinterpret_cast<opus_int16*>(decoded.data()), TestBufferSize, 0);
>>     Pa_WriteStream(TestStream, decoded.data(), TestBufferSize);
>>
>> }
>>
>>
>> Can anyone advice me what to enter as parameters in the toxav_audio_send_frame() and in static void t_toxav_receive_audio_frame_cb() ?
>>
>> sorry for my noobish question and thanks for your time but i really need to make it work and i almost combined many variables and couldnt make it
>>
>> someone with good knowledge on what to send i think is very easy to tell me what vars should i use in the send and recieve function
>>
>>
>> Thanks in advance
>>
> 
> What is the error you're getting?
> 
> --
> 
> Kind regards,
> Zetok Zalbavar
> ----
> tox:29AE62F95C56063D833024B1CB5C2140DC4AEB94A80FF4596CACC460D7BAA062E0A92C3424A0
> 
> 

-- 

Kind regards,
Zetok Zalbavar
----
tox:29AE62F95C56063D833024B1CB5C2140DC4AEB94A80FF4596CACC460D7BAA062E0A92C3424A0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.tox.chat/pipermail/support/attachments/20161208/7f481acf/attachment.sig>


More information about the Support mailing list