Skip to content

Commit 95fd837

Browse files
committed
Prevent frame que object from being reinitialized which could be unsafe if another thread and/or object is using it.
1 parent b3d4b8d commit 95fd837

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

modules/cudacodec/src/frame_queue.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,10 @@ cv::cudacodec::detail::FrameQueue::~FrameQueue() {
5555
delete[] isFrameInUse_;
5656
}
5757

58-
void cv::cudacodec::detail::FrameQueue::init(const int _maxSz, const bool force) {
58+
void cv::cudacodec::detail::FrameQueue::init(const int _maxSz) {
5959
AutoLock autoLock(mtx_);
60-
if (isFrameInUse_) {
61-
if (force)
62-
delete[] isFrameInUse_;
63-
else
64-
return;
65-
}
60+
if (isFrameInUse_)
61+
return;
6662
maxSz = _maxSz;
6763
displayQueue_ = std::vector<CUVIDPARSERDISPINFO>(maxSz, CUVIDPARSERDISPINFO());
6864
isFrameInUse_ = new volatile int[maxSz];

modules/cudacodec/src/frame_queue.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class FrameQueue
6363
{
6464
public:
6565
~FrameQueue();
66-
void init(const int _maxSz, const bool force = false);
66+
void init(const int _maxSz);
6767

6868
void endDecode() { endOfDecode_ = true; }
6969
bool isEndOfDecode() const { return endOfDecode_ != 0;}

0 commit comments

Comments
 (0)