From 7e0ebcd1f19c8365d16a5fb5a42907867d15cb20 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 6 Dec 2012 20:27:00 +0000 Subject: Remove exception thrown on a short audio frame. I don't think the caller can reasonably be expected to know what constitutes a DCP audio "frame", so it's not really for them to round their inputs. libdcp will fill any shortfall with silence, anyway. --- src/sound_asset.cc | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/sound_asset.cc b/src/sound_asset.cc index 500a72e5..e987239a 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -155,25 +155,18 @@ SoundAsset::construct (boost::function get_path) for (int i = 0; i < _length; ++i) { - byte_t *data_s = frame_buffer.Data(); - byte_t *data_e = data_s + frame_buffer.Capacity(); - byte_t sample_size = ASDCP::PCM::CalcSampleSize (audio_desc_channel[0]); - int offset = 0; - for (int j = 0; j < _channels; ++j) { memset (frame_buffer_channel[j].Data(), 0, frame_buffer_channel[j].Capacity()); if (ASDCP_FAILURE (pcm_parser_channel[j].ReadFrame (frame_buffer_channel[j]))) { throw MiscError ("could not read audio frame"); } - - if (frame_buffer_channel[j].Size() != frame_buffer_channel[j].Capacity()) { - stringstream s; - s << "short audio frame; " << _channels << " channels, " - << frame_buffer_channel[j].Size() << " vs " << frame_buffer_channel[j].Capacity(); - throw MiscError (s.str ()); - } } + byte_t *data_s = frame_buffer.Data(); + byte_t *data_e = data_s + frame_buffer.Capacity(); + byte_t sample_size = ASDCP::PCM::CalcSampleSize (audio_desc_channel[0]); + int offset = 0; + while (data_s < data_e) { for (int j = 0; j < _channels; ++j) { byte_t* frame = frame_buffer_channel[j].Data() + offset; -- cgit v1.2.3