Fix FFmpeg frame generator ending.

This commit is contained in:
John Preston 2022-09-08 09:50:11 +04:00
parent b0203af398
commit ab25cf214c
1 changed files with 14 additions and 14 deletions

View File

@ -343,22 +343,22 @@ void FrameGenerator::Impl::readNextFrame() {
return;
}
} while (packet.fields().stream_index != _streamId);
if (finished) {
continue;
result = avcodec_send_packet(_codec.get(), nullptr); // Drain.
} else {
const auto native = &packet.fields();
const auto guard = gsl::finally([
&,
size = native->size,
data = native->data
] {
native->size = size;
native->data = data;
packet = Packet();
});
result = avcodec_send_packet(_codec.get(), native);
}
const auto native = &packet.fields();
const auto guard = gsl::finally([
&,
size = native->size,
data = native->data
] {
native->size = size;
native->data = data;
packet = Packet();
});
result = avcodec_send_packet(_codec.get(), native);
if (result < 0) {
LOG(("Webm Error: Unable to avcodec_send_packet(), ")
+ wrapError(result));