Fix encoder not flushing the frames properly
Thanks IRC!
This commit is contained in:
parent
951d5f99a7
commit
2ccc2ca0f9
@ -145,6 +145,7 @@ bool Encoder::end() {
|
||||
if (!success) {
|
||||
goto cleanup;
|
||||
}
|
||||
avcodec_send_frame(out->enc, NULL);
|
||||
int ret;
|
||||
AVPacket pkt;
|
||||
pkt.size = 0;
|
||||
|
@ -31,7 +31,7 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
||||
path = tmpDir.absoluteFilePath("res." + formats::recordingFormatName(f).toLower());
|
||||
finalizer = [&] {
|
||||
delete enc;
|
||||
if (interrupt) {
|
||||
if (interrupt || !frameAdded) {
|
||||
tmpDir.removeRecursively();
|
||||
return QByteArray();
|
||||
}
|
||||
@ -66,6 +66,7 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
||||
};
|
||||
consumer = [&](QImage img) {
|
||||
if (!interrupt) try {
|
||||
frameAdded = true;
|
||||
enc->addFrame(img);
|
||||
} catch (std::runtime_error e) {
|
||||
// notifications::notify("KShare Video Encoder Error", e.what(),
|
||||
|
@ -31,6 +31,7 @@ private:
|
||||
QString path;
|
||||
Encoder *enc = NULL;
|
||||
bool interrupt = false;
|
||||
bool frameAdded = false;
|
||||
QString anotherFormat;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user