mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 22:27:13 +02:00
loopback local injectors on server echo
This commit is contained in:
parent
01d2d9243a
commit
768354e49f
3 changed files with 11 additions and 5 deletions
|
@ -167,7 +167,8 @@ public slots:
|
|||
|
||||
int setOutputBufferSize(int numFrames, bool persist = true);
|
||||
|
||||
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) override;
|
||||
bool outputLocalInjector(bool isStereo, AudioInjector* injector) override;
|
||||
bool shouldLoopbackInjectors() override { return _shouldEchoToServer; }
|
||||
|
||||
bool switchInputToAudioDevice(const QString& inputDeviceName);
|
||||
bool switchOutputToAudioDevice(const QString& outputDeviceName);
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
|
||||
public slots:
|
||||
virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) = 0;
|
||||
virtual bool shouldLoopbackInjectors() { return false; }
|
||||
|
||||
virtual void setIsStereoInput(bool stereo) = 0;
|
||||
};
|
||||
|
|
|
@ -211,6 +211,7 @@ int64_t AudioInjector::injectNextFrame() {
|
|||
}
|
||||
|
||||
// if we haven't setup the packet to send then do so now
|
||||
static int loopbackOptionOffset = -1;
|
||||
static int positionOptionOffset = -1;
|
||||
static int volumeOptionOffset = -1;
|
||||
static int audioDataOffset = -1;
|
||||
|
@ -260,10 +261,9 @@ int64_t AudioInjector::injectNextFrame() {
|
|||
// pack the stereo/mono type of the stream
|
||||
audioPacketStream << _options.stereo;
|
||||
|
||||
// pack the flag for loopback. Now, we don't loopback
|
||||
// and _always_ play locally, so loopbackFlag should be
|
||||
// false always.
|
||||
uchar loopbackFlag = (uchar)false;
|
||||
// pack the flag for loopback, if requested
|
||||
loopbackOptionOffset = _currentPacket->pos();
|
||||
uchar loopbackFlag = (_localAudioInterface && _localAudioInterface->shouldLoopbackInjectors());
|
||||
audioPacketStream << loopbackFlag;
|
||||
|
||||
// pack the position for injected audio
|
||||
|
@ -293,6 +293,7 @@ int64_t AudioInjector::injectNextFrame() {
|
|||
return NEXT_FRAME_DELTA_ERROR_OR_FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_frameTimer->isValid()) {
|
||||
// in the case where we have been restarted, the frame timer will be invalid and we need to start it back over here
|
||||
_frameTimer->restart();
|
||||
|
@ -317,6 +318,9 @@ int64_t AudioInjector::injectNextFrame() {
|
|||
// pack the sequence number
|
||||
_currentPacket->writePrimitive(_outgoingSequenceNumber);
|
||||
|
||||
_currentPacket->seek(loopbackOptionOffset);
|
||||
_currentPacket->writePrimitive((uchar)(_localAudioInterface && _localAudioInterface->shouldLoopbackInjectors()));
|
||||
|
||||
_currentPacket->seek(positionOptionOffset);
|
||||
_currentPacket->writePrimitive(_options.position);
|
||||
_currentPacket->writePrimitive(_options.orientation);
|
||||
|
|
Loading…
Reference in a new issue