ffmepg 导入, 视频解码初始化逻辑, 视频解码线程逻辑

This commit is contained in:
Jie
2024-09-30 16:11:07 +08:00
parent 1237b164bf
commit 15018f4079
8 changed files with 127 additions and 6 deletions

View File

@@ -9,7 +9,8 @@ public:
~ThreadQueue() = default;
void push(const T& value) {
std::lock_guard<std::mutex> lock(mutex_);
std::unique_lock<std::mutex> lock(mutex_);
condition_.wait(lock, [this](){ return queue_.size() <= maxSize; });
queue_.push(value);
condition_.notify_one();
}
@@ -19,6 +20,7 @@ public:
condition_.wait(lock, [this] { return !queue_.empty(); });
T value = queue_.front();
queue_.pop();
condition_.notify_one();
return value;
}
@@ -35,4 +37,5 @@ private:
std::queue<T> queue_;
mutable std::mutex mutex_;
std::condition_variable condition_;
unsigned int maxSize = 50;
};