Remove exception thrown on a short audio frame. I don't think
authorCarl Hetherington <cth@carlh.net>
Thu, 6 Dec 2012 20:27:00 +0000 (20:27 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 6 Dec 2012 20:27:00 +0000 (20:27 +0000)
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

index 500a72e5c09e73219aa01b82a6474d4add87fb46..e987239a498eef3686a8cd80d00f249f4e07e831 100644 (file)
@@ -155,25 +155,18 @@ SoundAsset::construct (boost::function<string (Channel)> 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;