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) {
|
if (!success) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
avcodec_send_frame(out->enc, NULL);
|
||||||
int ret;
|
int ret;
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
pkt.size = 0;
|
pkt.size = 0;
|
||||||
|
@ -31,7 +31,7 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
|||||||
path = tmpDir.absoluteFilePath("res." + formats::recordingFormatName(f).toLower());
|
path = tmpDir.absoluteFilePath("res." + formats::recordingFormatName(f).toLower());
|
||||||
finalizer = [&] {
|
finalizer = [&] {
|
||||||
delete enc;
|
delete enc;
|
||||||
if (interrupt) {
|
if (interrupt || !frameAdded) {
|
||||||
tmpDir.removeRecursively();
|
tmpDir.removeRecursively();
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
@ -66,6 +66,7 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
|||||||
};
|
};
|
||||||
consumer = [&](QImage img) {
|
consumer = [&](QImage img) {
|
||||||
if (!interrupt) try {
|
if (!interrupt) try {
|
||||||
|
frameAdded = true;
|
||||||
enc->addFrame(img);
|
enc->addFrame(img);
|
||||||
} catch (std::runtime_error e) {
|
} catch (std::runtime_error e) {
|
||||||
// notifications::notify("KShare Video Encoder Error", e.what(),
|
// notifications::notify("KShare Video Encoder Error", e.what(),
|
||||||
|
@ -31,6 +31,7 @@ private:
|
|||||||
QString path;
|
QString path;
|
||||||
Encoder *enc = NULL;
|
Encoder *enc = NULL;
|
||||||
bool interrupt = false;
|
bool interrupt = false;
|
||||||
|
bool frameAdded = false;
|
||||||
QString anotherFormat;
|
QString anotherFormat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user