1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

style: run format-code.sh on the files

This commit is contained in:
sudden6 2017-10-28 14:17:14 +02:00
parent 90bf0a7e2c
commit 967dab8700
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
3 changed files with 36 additions and 32 deletions

View File

@ -18,8 +18,8 @@
along with qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core.h"
#include "coreav.h"
#include "core.h"
#include "src/audio/audio.h"
#include "src/model/friend.h"
#include "src/model/group.h"
@ -227,7 +227,8 @@ bool CoreAV::answerCall(uint32_t friendNum, bool video)
bool ret;
QMetaObject::invokeMethod(this, "answerCall", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(bool, ret), Q_ARG(uint32_t, friendNum), Q_ARG(bool, video));
Q_RETURN_ARG(bool, ret), Q_ARG(uint32_t, friendNum),
Q_ARG(bool, video));
threadSwitchLock.clear(std::memory_order_release);
return ret;
@ -343,7 +344,8 @@ bool CoreAV::sendCallAudio(uint32_t callId, const int16_t* pcm, size_t samples,
ToxFriendCall& call = calls[callId];
if (call.getMuteMic() || call.isActive() || !(call.getState() & TOXAV_FRIEND_CALL_STATE_ACCEPTING_A)) {
if (call.getMuteMic() || call.isActive()
|| !(call.getState() & TOXAV_FRIEND_CALL_STATE_ACCEPTING_A)) {
return true;
}
@ -377,7 +379,8 @@ void CoreAV::sendCallVideo(uint32_t callId, std::shared_ptr<VideoFrame> vframe)
ToxFriendCall& call = calls[callId];
if (!call.getVideoEnabled() || call.isActive() || !(call.getState() & TOXAV_FRIEND_CALL_STATE_ACCEPTING_V)) {
if (!call.getVideoEnabled() || call.isActive()
|| !(call.getState() & TOXAV_FRIEND_CALL_STATE_ACCEPTING_V)) {
return;
}
@ -465,8 +468,7 @@ void CoreAV::groupCallCallback(void* tox, int group, int peer, const int16_t* da
emit c->groupPeerAudioPlaying(group, peer);
if (call.getMuteVol() || !call.isActive())
{
if (call.getMuteVol() || !call.isActive()) {
return;
}
@ -634,7 +636,7 @@ bool CoreAV::isGroupAvEnabled(int groupId) const
bool CoreAV::isCallInputMuted(const Friend* f) const
{
if (!f) {
return false;
return false;
}
const uint32_t friendId = f->getId();
return (calls.find(friendId) != calls.end()) && calls[friendId].getMuteMic();
@ -648,7 +650,7 @@ bool CoreAV::isCallInputMuted(const Friend* f) const
bool CoreAV::isCallOutputMuted(const Friend* f) const
{
if (!f) {
return false;
return false;
}
const uint32_t friendId = f->getId();
return (calls.find(friendId) != calls.end()) && calls[f->getId()].getMuteVol();

View File

@ -39,10 +39,11 @@ ToxCall::ToxCall()
audio.subscribeInput();
}
ToxCall::ToxCall(ToxCall&& other) noexcept : audioInConn{other.audioInConn},
active{other.active},
muteMic{other.muteMic},
muteVol{other.muteVol}
ToxCall::ToxCall(ToxCall&& other) noexcept
: audioInConn{other.audioInConn}
, active{other.active}
, muteMic{other.muteMic}
, muteVol{other.muteVol}
{
other.audioInConn = QMetaObject::Connection();
// invalidate object, all resources are moved
@ -54,7 +55,7 @@ ToxCall::~ToxCall()
Audio& audio = Audio::getInstance();
// only free resources if they weren't moved
if(valid) {
if (valid) {
QObject::disconnect(audioInConn);
audio.unsubscribeInput();
}
@ -147,7 +148,7 @@ void ToxFriendCall::setNullVideoBitrate(bool value)
nullVideoBitrate = value;
}
CoreVideoSource *ToxFriendCall::getVideoSource() const
CoreVideoSource* ToxFriendCall::getVideoSource() const
{
return videoSource;
}
@ -157,7 +158,7 @@ TOXAV_FRIEND_CALL_STATE ToxFriendCall::getState() const
return state;
}
void ToxFriendCall::setState(const TOXAV_FRIEND_CALL_STATE &value)
void ToxFriendCall::setState(const TOXAV_FRIEND_CALL_STATE& value)
{
state = value;
}
@ -167,7 +168,7 @@ quint32 ToxFriendCall::getAlSource() const
return alSource;
}
void ToxFriendCall::setAlSource(const quint32 &value)
void ToxFriendCall::setAlSource(const quint32& value)
{
alSource = value;
}
@ -184,10 +185,10 @@ ToxFriendCall::ToxFriendCall(uint32_t friendId, bool VideoEnabled, CoreAV& av)
Audio& audio = Audio::getInstance();
audioInConn = QObject::connect(&audio, &Audio::frameAvailable,
[&av, friendId](const int16_t* pcm, size_t samples,
uint8_t chans, uint32_t rate) {
uint8_t chans, uint32_t rate) {
av.sendCallAudio(friendId, pcm, samples, chans, rate);
});
if(!audioInConn) {
if (!audioInConn) {
qDebug() << "Audio connection not working";
}
@ -209,14 +210,14 @@ ToxFriendCall::ToxFriendCall(uint32_t friendId, bool VideoEnabled, CoreAV& av)
}
ToxFriendCall::ToxFriendCall(ToxFriendCall&& other) noexcept
: ToxCall(move(other)),
alSource{other.alSource},
videoEnabled{other.videoEnabled},
nullVideoBitrate{other.nullVideoBitrate},
videoSource{other.videoSource},
state{other.state},
av{other.av},
timeoutTimer{other.timeoutTimer}
: ToxCall(move(other))
, alSource{other.alSource}
, videoEnabled{other.videoEnabled}
, nullVideoBitrate{other.nullVideoBitrate}
, videoSource{other.videoSource}
, state{other.state}
, av{other.av}
, timeoutTimer{other.timeoutTimer}
{
other.videoEnabled = false;
other.videoSource = nullptr;
@ -242,7 +243,7 @@ ToxFriendCall::~ToxFriendCall()
videoSource = nullptr;
}
}
if(valid) {
if (valid) {
Audio::getInstance().unsubscribeOutput(alSource);
}
}
@ -280,8 +281,9 @@ ToxGroupCall::ToxGroupCall(int GroupNum, CoreAV& av)
});
}
ToxGroupCall::ToxGroupCall(ToxGroupCall&& other) noexcept : ToxCall(move(other))
, peers{other.peers}
ToxGroupCall::ToxGroupCall(ToxGroupCall&& other) noexcept
: ToxCall(move(other))
, peers{other.peers}
{
// all peers were moved, this ensures audio output is unsubscribed only once
other.peers.clear();

View File

@ -63,13 +63,13 @@ public:
bool getNullVideoBitrate() const;
void setNullVideoBitrate(bool value);
CoreVideoSource *getVideoSource() const;
CoreVideoSource* getVideoSource() const;
TOXAV_FRIEND_CALL_STATE getState() const;
void setState(const TOXAV_FRIEND_CALL_STATE &value);
void setState(const TOXAV_FRIEND_CALL_STATE& value);
quint32 getAlSource() const;
void setAlSource(const quint32 &value);
void setAlSource(const quint32& value);
private:
quint32 alSource;