Fix logic error in encoder wait_idle
This commit is contained in:
@@ -46,22 +46,21 @@ VideoEncoder::sender::sender() :
|
|||||||
thread([this](std::stop_token t) {
|
thread([this](std::stop_token t) {
|
||||||
while (not t.stop_requested())
|
while (not t.stop_requested())
|
||||||
{
|
{
|
||||||
data d;
|
data * d = nullptr;
|
||||||
{
|
{
|
||||||
std::unique_lock lock(mutex);
|
std::unique_lock lock(mutex);
|
||||||
if (pending.empty())
|
if (pending.empty())
|
||||||
{
|
|
||||||
cv.wait_for(lock, std::chrono::milliseconds(100));
|
cv.wait_for(lock, std::chrono::milliseconds(100));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
d = &pending.front();
|
||||||
d = std::move(pending.front());
|
}
|
||||||
pending.pop_front();
|
if (d and not d->span.empty())
|
||||||
cv.notify_all();
|
{
|
||||||
}
|
d->encoder->SendData(d->span, true);
|
||||||
|
std::unique_lock lock(mutex);
|
||||||
|
pending.pop_front();
|
||||||
|
cv.notify_all();
|
||||||
}
|
}
|
||||||
if (not d.span.empty())
|
|
||||||
d.encoder->SendData(d.span, true);
|
|
||||||
}
|
}
|
||||||
std::unique_lock lock(mutex);
|
std::unique_lock lock(mutex);
|
||||||
pending.clear();
|
pending.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user