fixed crashes when exporting only video or only audio
This commit is contained in:
+4
-4
@@ -322,9 +322,9 @@ void ExportThread::run() {
|
||||
|
||||
continueEncode = setupContainer();
|
||||
|
||||
if (continueEncode) continueEncode = setupVideo();
|
||||
if (video_enabled && continueEncode) continueEncode = setupVideo();
|
||||
|
||||
if (continueEncode) continueEncode = setupAudio();
|
||||
if (audio_enabled && continueEncode) continueEncode = setupAudio();
|
||||
|
||||
if (continueEncode) {
|
||||
ret = avformat_write_header(fmt_ctx, NULL);
|
||||
@@ -412,8 +412,8 @@ void ExportThread::run() {
|
||||
if (continueEncode) {
|
||||
// flush remaining packets
|
||||
while (continueVideo && continueAudio) {
|
||||
if (continueVideo) continueVideo = encode(fmt_ctx, vcodec_ctx, NULL, &video_pkt, video_stream);
|
||||
if (continueAudio) continueAudio = encode(fmt_ctx, acodec_ctx, NULL, &audio_pkt, audio_stream);
|
||||
if (continueVideo && video_enabled) continueVideo = encode(fmt_ctx, vcodec_ctx, NULL, &video_pkt, video_stream);
|
||||
if (continueAudio && audio_enabled) continueAudio = encode(fmt_ctx, acodec_ctx, NULL, &audio_pkt, audio_stream);
|
||||
}
|
||||
|
||||
ret = av_write_trailer(fmt_ctx);
|
||||
|
||||
+2
-5
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
#include "project/clip.h"
|
||||
|
||||
Media::Media() : ready(false), preview_gen(NULL), throbber(NULL) {
|
||||
Media::Media() : ready(false), preview_gen(NULL) {
|
||||
ready_lock.lock();
|
||||
}
|
||||
|
||||
@@ -22,10 +22,7 @@ void Media::reset() {
|
||||
if (preview_gen != NULL) {
|
||||
preview_gen->cancel();
|
||||
preview_gen->wait();
|
||||
}
|
||||
if (throbber != NULL) {
|
||||
delete throbber;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<video_tracks.size();i++) {
|
||||
delete video_tracks.at(i);
|
||||
}
|
||||
|
||||
+1
-2
@@ -53,8 +53,7 @@ struct Media {
|
||||
int save_id;
|
||||
bool ready;
|
||||
|
||||
PreviewGenerator* preview_gen;
|
||||
MediaThrobber* throbber;
|
||||
PreviewGenerator* preview_gen;
|
||||
QMutex ready_lock;
|
||||
|
||||
bool using_inout;
|
||||
|
||||
Reference in New Issue
Block a user