mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:21:16 +02:00
Merge pull request #6986 from birarda/injector-restart
fix for injector restart not restarting
This commit is contained in:
commit
4ed38c4104
1 changed files with 10 additions and 0 deletions
|
@ -102,6 +102,11 @@ void AudioInjector::restart() {
|
||||||
// reset the current send offset to zero
|
// reset the current send offset to zero
|
||||||
_currentSendOffset = 0;
|
_currentSendOffset = 0;
|
||||||
|
|
||||||
|
// reset state to start sending from beginning again
|
||||||
|
_nextFrame = 0;
|
||||||
|
_frameTimer->invalidate();
|
||||||
|
_hasSentFirstFrame = false;
|
||||||
|
|
||||||
// check our state to decide if we need extra handling for the restart request
|
// check our state to decide if we need extra handling for the restart request
|
||||||
if (_state == State::Finished) {
|
if (_state == State::Finished) {
|
||||||
// we finished playing, need to reset state so we can get going again
|
// we finished playing, need to reset state so we can get going again
|
||||||
|
@ -246,6 +251,11 @@ int64_t AudioInjector::injectNextFrame() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
int totalBytesLeftToCopy = (_options.stereo ? 2 : 1) * AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL;
|
int totalBytesLeftToCopy = (_options.stereo ? 2 : 1) * AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL;
|
||||||
if (!_options.loop) {
|
if (!_options.loop) {
|
||||||
// If we aren't looping, let's make sure we don't read past the end
|
// If we aren't looping, let's make sure we don't read past the end
|
||||||
|
|
Loading…
Reference in a new issue