Fix MS20089: Enable interrupting of avatar recordings with sounds

This commit is contained in:
Zach Fox 2018-12-17 15:46:08 -08:00
parent 78c9fb2b91
commit 240917e8ae
2 changed files with 12 additions and 0 deletions

View file

@ -756,6 +756,11 @@ void Agent::processAgentAvatarAudio() {
const int16_t* nextSoundOutput = NULL;
if (_avatarSound) {
if (isPlayingRecording) {
recordingInterface->stopPlaying();
_recordingInterrupted = true;
}
auto audioData = _avatarSound->getAudioData();
nextSoundOutput = reinterpret_cast<const int16_t*>(audioData->rawData()
+ _numAvatarSoundSentBytes);
@ -781,6 +786,11 @@ void Agent::processAgentAvatarAudio() {
_avatarSound.clear();
_numAvatarSoundSentBytes = 0;
_flushEncoder = true;
if (_recordingInterrupted) {
_recordingInterrupted = false;
recordingInterface->startPlaying();
}
}
}

View file

@ -122,6 +122,8 @@ private:
Encoder* _encoder { nullptr };
QTimer _avatarAudioTimer;
bool _flushEncoder { false };
bool _recordingInterrupted { false };
};
#endif // hifi_Agent_h