void Core::prepareCall(int friendId, int callId, ToxAv* toxav, bool videoEnabled) { qDebug() << QString("Core: preparing call %1").arg(callId); calls[callId].callId = callId; calls[callId].friendId = friendId; calls[callId].muteMic = false; // the following three lines are also now redundant from startCall, but are // necessary there for outbound and here for inbound calls[callId].codecSettings = av_DefaultSettings; calls[callId].codecSettings.max_video_width = TOXAV_MAX_VIDEO_WIDTH; calls[callId].codecSettings.max_video_height = TOXAV_MAX_VIDEO_HEIGHT; calls[callId].videoEnabled = videoEnabled; toxav_prepare_transmission(toxav, callId, av_jbufdc, av_VADd, videoEnabled); // Audio alGenSources(1, &calls[callId].alSource); alcCaptureStart(alInDev); // Go calls[callId].active = true; calls[callId].sendAudioTimer->setInterval(5); calls[callId].sendAudioTimer->setSingleShot(true); connect(calls[callId].sendAudioTimer, &QTimer::timeout, [=](){sendCallAudio(callId,toxav);}); calls[callId].sendAudioTimer->start(); calls[callId].sendVideoTimer->setInterval(50); calls[callId].sendVideoTimer->setSingleShot(true); if (calls[callId].videoEnabled) { calls[callId].sendVideoTimer->start(); Widget::getInstance()->getCamera()->suscribe(); } }
void Core::prepareCall(uint32_t friendId, int32_t callId, ToxAv* toxav, bool videoEnabled) { qDebug() << QString("Core: preparing call %1").arg(callId); if (!videobuf) videobuf = new uint8_t[videobufsize]; calls[callId].callId = callId; calls[callId].friendId = friendId; calls[callId].muteMic = false; calls[callId].muteVol = false; // the following three lines are also now redundant from startCall, but are // necessary there for outbound and here for inbound calls[callId].codecSettings = av_DefaultSettings; calls[callId].codecSettings.max_video_width = TOXAV_MAX_VIDEO_WIDTH; calls[callId].codecSettings.max_video_height = TOXAV_MAX_VIDEO_HEIGHT; calls[callId].videoEnabled = videoEnabled; int r = toxav_prepare_transmission(toxav, callId, videoEnabled); if (r < 0) qWarning() << QString("Error starting call %1: toxav_prepare_transmission failed with %2").arg(callId).arg(r); // Audio Audio::suscribeInput(); // Go calls[callId].active = true; calls[callId].sendAudioTimer->setInterval(5); calls[callId].sendAudioTimer->setSingleShot(true); connect(calls[callId].sendAudioTimer, &QTimer::timeout, [=](){sendCallAudio(callId,toxav);}); calls[callId].sendAudioTimer->start(); calls[callId].sendVideoTimer->setInterval(50); calls[callId].sendVideoTimer->setSingleShot(true); if (calls[callId].videoEnabled) { calls[callId].sendVideoTimer->start(); Camera::getInstance()->subscribe(); } #ifdef QTOX_FILTER_AUDIO if (Settings::getInstance().getFilterAudio()) { filterer[callId] = new AudioFilterer(); filterer[callId]->startFilter(48000); } else { delete filterer[callId]; filterer[callId] = nullptr; } #endif }