diff --git a/lib/tlDevice/BMDOutputCallback.cpp b/lib/tlDevice/BMDOutputCallback.cpp index 52f0fd00..a75a5dd0 100644 --- a/lib/tlDevice/BMDOutputCallback.cpp +++ b/lib/tlDevice/BMDOutputCallback.cpp @@ -107,10 +107,15 @@ namespace tl timeline::Playback value, const otime::RationalTime& time) { - std::unique_lock lock(_audioMutex.mutex); - if (value != _audioMutex.playback) + if (value == _playback) + return; + _playback = value; { - _dlOutput->FlushBufferedAudioSamples(); + std::unique_lock lock(_videoMutex.mutex); + _videoMutex.videoFrames.clear(); + } + { + std::unique_lock lock(_audioMutex.mutex); _audioMutex.playback = value; _audioMutex.reset = true; _audioMutex.start = time; @@ -118,21 +123,21 @@ namespace tl } } - void DLOutputCallback::setCurrentTime(const otime::RationalTime& time) - { - std::unique_lock lock(_audioMutex.mutex); - _audioMutex.current = time; - } - void DLOutputCallback::seek(const otime::RationalTime& time) { if (time == _seek) return; _seek = time; - std::unique_lock lock(_audioMutex.mutex); - _audioMutex.reset = true; - _audioMutex.start = time; - _audioMutex.current = time; + { + std::unique_lock lock(_videoMutex.mutex); + _videoMutex.videoFrames.clear(); + } + { + std::unique_lock lock(_audioMutex.mutex); + _audioMutex.reset = true; + _audioMutex.start = time; + _audioMutex.current = time; + } } void DLOutputCallback::setVideo(const std::shared_ptr& value) @@ -371,7 +376,7 @@ namespace tl nullptr); // Update the frame counter. - _audioThread.frame += audioList[0]->getSampleCount(); + _audioThread.frame += audio->getSampleCount(); } else { diff --git a/lib/tlDevice/BMDOutputDevice.cpp b/lib/tlDevice/BMDOutputDevice.cpp index f5b7d7d9..d4ed50a9 100644 --- a/lib/tlDevice/BMDOutputDevice.cpp +++ b/lib/tlDevice/BMDOutputDevice.cpp @@ -725,8 +725,6 @@ namespace tl p.thread.dl->outputCallback->setPlayback( playback, currentTime - p.thread.timeRange.start_time()); - p.thread.dl->outputCallback->setCurrentTime( - currentTime - p.thread.timeRange.start_time()); p.thread.dl->outputCallback->seek( seek - p.thread.timeRange.start_time()); } diff --git a/lib/tlDevice/BMDOutputPrivate.h b/lib/tlDevice/BMDOutputPrivate.h index 60b77ae0..5c54f7e1 100644 --- a/lib/tlDevice/BMDOutputPrivate.h +++ b/lib/tlDevice/BMDOutputPrivate.h @@ -134,7 +134,6 @@ namespace tl const audio::Info& audioInfo); void setPlayback(timeline::Playback, const otime::RationalTime&); - void setCurrentTime(const otime::RationalTime&); void seek(const otime::RationalTime&); void setVideo(const std::shared_ptr&); void setVolume(float); @@ -157,6 +156,7 @@ namespace tl PixelType _pixelType = PixelType::None; FrameRate _frameRate; audio::Info _audioInfo; + timeline::Playback _playback = timeline::Playback::Stop; otime::RationalTime _seek = time::invalidTime; std::atomic _refCount;