From: Carl Hetherington Date: Fri, 29 Dec 2017 01:01:19 +0000 (+0000) Subject: Add an assertion and a better error message. X-Git-Tag: v1.5.0~26 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=7d0aab7961d72ab194b1c9f2c6f348a91ed75c35;p=libdcp.git Add an assertion and a better error message. --- diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc index e628b26e..3cb25db5 100644 --- a/src/sound_asset_writer.cc +++ b/src/sound_asset_writer.cc @@ -93,6 +93,7 @@ void SoundAssetWriter::write (float const * const * data, int frames) { DCP_ASSERT (!_finalized); + DCP_ASSERT (frames > 0); static float const clip = 1.0f - (1.0f / pow (2, 23)); @@ -157,8 +158,11 @@ SoundAssetWriter::finalize () write_current_frame (); } - if (_started && ASDCP_FAILURE (_state->mxf_writer.Finalize())) { - boost::throw_exception (MiscError ("could not finalise audio MXF")); + if (_started) { + ASDCP::Result_t const r = _state->mxf_writer.Finalize(); + if (ASDCP_FAILURE(r)) { + boost::throw_exception (MiscError (String::compose ("could not finalise audio MXF (%1)", int(r)))); + } } _asset->_intrinsic_duration = _frames_written;