diff --git a/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp b/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp index 2e182f7..172c3b5 100644 --- a/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp @@ -57,7 +57,6 @@ private: SequentialBuffer videoBuffer_; std::unique_ptr videoWidget_; std::unique_ptr mediaPlayer_; - std::mutex mutex_; }; } diff --git a/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp b/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp index 361f808..153b687 100644 --- a/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp +++ b/include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp @@ -44,6 +44,7 @@ public: bool reset() override; bool canReadLine() const override; qint64 bytesAvailable() const override; + bool open(OpenMode mode) override; protected: qint64 readData(char *data, qint64 maxlen) override; diff --git a/src/autoapp/Projection/QtVideoOutput.cpp b/src/autoapp/Projection/QtVideoOutput.cpp index 0cbffde..ad4636c 100644 --- a/src/autoapp/Projection/QtVideoOutput.cpp +++ b/src/autoapp/Projection/QtVideoOutput.cpp @@ -49,8 +49,6 @@ void QtVideoOutput::createVideoOutput() bool QtVideoOutput::open() { - std::lock_guard lock(mutex_); - return videoBuffer_.open(QIODevice::ReadWrite); } @@ -67,15 +65,11 @@ void QtVideoOutput::stop() void QtVideoOutput::write(uint64_t, const aasdk::common::DataConstBuffer& buffer) { - std::lock_guard lock(mutex_); - videoBuffer_.write(reinterpret_cast(buffer.cdata), buffer.size); } void QtVideoOutput::onStartPlayback() { - std::lock_guard lock(mutex_); - videoWidget_->setAspectRatioMode(Qt::IgnoreAspectRatio); videoWidget_->setFocus(); videoWidget_->setWindowFlags(Qt::WindowStaysOnTopHint); @@ -89,8 +83,6 @@ void QtVideoOutput::onStartPlayback() void QtVideoOutput::onStopPlayback() { - std::lock_guard lock(mutex_); - videoWidget_->hide(); mediaPlayer_->stop(); } diff --git a/src/autoapp/Projection/SequentialBuffer.cpp b/src/autoapp/Projection/SequentialBuffer.cpp index e4a2911..bd90a45 100644 --- a/src/autoapp/Projection/SequentialBuffer.cpp +++ b/src/autoapp/Projection/SequentialBuffer.cpp @@ -37,6 +37,13 @@ bool SequentialBuffer::isSequential() const return true; } +bool SequentialBuffer::open(OpenMode mode) +{ + std::lock_guard lock(mutex_); + + return QIODevice::open(mode); +} + qint64 SequentialBuffer::readData(char *data, qint64 maxlen) { std::lock_guard lock(mutex_);