From 062aeb02623130c5cf1143b7fec3656acdfac478 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 8 Dec 2020 01:09:19 +0100 Subject: [PATCH] Bail out if export cannot be started --- libs/ardour/ardour/export_handler.h | 4 ++-- libs/ardour/export_handler.cc | 10 +++++----- session_utils/export.cc | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index d270f4d82d..f7f9818544 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -109,7 +109,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr bool add_export_config (ExportTimespanPtr timespan, ExportChannelConfigPtr channel_config, ExportFormatSpecPtr format, ExportFilenamePtr filename, BroadcastInfoPtr broadcast_info); - void do_export (); + int do_export (); std::string get_cd_marker_filename(std::string filename, CDMarkerFormat format); @@ -148,7 +148,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr static void* start_timespan_bg (void*); - void start_timespan (); + int start_timespan (); int process_timespan (samplecnt_t samples); int post_process (); void finish_timespan (); diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 4e365bd431..759a5544d9 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -138,7 +138,7 @@ ExportHandler::add_export_config (ExportTimespanPtr timespan, ExportChannelConfi return true; } -void +int ExportHandler::do_export () { /* Count timespans */ @@ -164,10 +164,10 @@ ExportHandler::do_export () /* Start export */ Glib::Threads::Mutex::Lock l (export_status->lock()); - start_timespan (); + return start_timespan (); } -void +int ExportHandler::start_timespan () { export_status->timespan++; @@ -183,7 +183,7 @@ ExportHandler::start_timespan () if (config_map.empty()) { // freewheeling has to be stopped from outside the process cycle export_status->set_running (false); - return; + return -1; } /* finish_timespan pops the config_map entry that has been done, so @@ -227,7 +227,7 @@ ExportHandler::start_timespan () session.ProcessExport.connect_same_thread (process_connection, boost::bind (&ExportHandler::process, this, _1)); process_position = current_timespan->get_start(); // TODO check if it's a RegionExport.. set flag to skip process_without_events() - session.start_audio_export (process_position, realtime, region_export); + return session.start_audio_export (process_position, realtime, region_export); } void diff --git a/session_utils/export.cc b/session_utils/export.cc index bc9307703c..0ed19b264c 100644 --- a/session_utils/export.cc +++ b/session_utils/export.cc @@ -178,7 +178,10 @@ static int export_session (Session *session, /* do audio export */ fmp->set_soundcloud_upload(false); session->get_export_handler()->add_export_config (tsp, ccp, fmp, fnp, b); - session->get_export_handler()->do_export(); + + if (0 != session->get_export_handler()->do_export()) { + return -1; + } boost::shared_ptr status = session->get_export_status ();