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

Use a source per call peer

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-11-13 20:18:02 +01:00
parent 796e6f0f4d
commit c550658e38
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 10 additions and 5 deletions

View File

@ -546,7 +546,7 @@ void Core::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, un
}
ALuint bufid;
ALint processed, queued;
ALint processed = 0, queued = 16;
alGetSourcei(alSource, AL_BUFFERS_PROCESSED, &processed);
alGetSourcei(alSource, AL_BUFFERS_QUEUED, &queued);
alSourcei(alSource, AL_LOOPING, AL_FALSE);
@ -586,7 +586,7 @@ VideoSource *Core::getVideoSourceFromCall(int callNumber)
return &calls[callNumber].videoSource;
}
void Core::playGroupAudio(Tox* /*tox*/, int groupnumber, int /*friendgroupnumber*/, const int16_t* out_audio,
void Core::playGroupAudio(Tox* /*tox*/, int groupnumber, int friendgroupnumber, const int16_t* out_audio,
unsigned out_audio_samples, uint8_t decoder_channels, unsigned audio_sample_rate, void* /*userdata*/)
{
if (!groupCalls[groupnumber].active)
@ -595,7 +595,11 @@ void Core::playGroupAudio(Tox* /*tox*/, int groupnumber, int /*friendgroupnumbe
if (groupCalls[groupnumber].muteVol)
return;
playAudioBuffer(alMainSource, out_audio, out_audio_samples, decoder_channels, audio_sample_rate);
if (!groupCalls[groupnumber].alSources.contains(friendgroupnumber))
alGenSources(1, &groupCalls[groupnumber].alSources[friendgroupnumber]);
playAudioBuffer(groupCalls[groupnumber].alSources[friendgroupnumber], out_audio,
out_audio_samples, decoder_channels, audio_sample_rate);
}
void Core::joinGroupCall(int groupId)
@ -611,7 +615,7 @@ void Core::joinGroupCall(int groupId)
groupCalls[groupId].codecSettings.max_video_height = TOXAV_MAX_VIDEO_HEIGHT;
// Audio
alGenSources(1, &groupCalls[groupId].alSource);
//alGenSources(1, &groupCalls[groupId].alSource);
alcCaptureStart(alInDev);
// Go

View File

@ -1,6 +1,7 @@
#ifndef COREAV_H
#define COREAV_H
#include <QHash>
#include <tox/toxav.h>
#include "video/netvideosource.h"
@ -36,7 +37,7 @@ struct ToxGroupCall
bool active;
bool muteMic;
bool muteVol;
ALuint alSource;
QHash<int, ALuint> alSources;
};
#endif // COREAV_H