summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-12 13:49:57 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-12 13:49:57 +0100
commitd19b7cbd3d1a428697bc9b26fdc0be36fafa444a (patch)
tree599e541098b179841c0fc268c5539dd4a0f87499 /src/lib
parentf0233eb1e3d6dfd9284d6c5e4865011550e2a0e3 (diff)
Add silence padding test.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/audio_buffers.cc1
-rw-r--r--src/lib/player.cc4
-rw-r--r--src/lib/sndfile_content.h5
3 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/audio_buffers.cc b/src/lib/audio_buffers.cc
index 6d4eb8514..7b3af91e0 100644
--- a/src/lib/audio_buffers.cc
+++ b/src/lib/audio_buffers.cc
@@ -209,6 +209,7 @@ AudioBuffers::accumulate_channel (AudioBuffers const * from, int from_channel, i
{
int const N = frames ();
assert (from->frames() == N);
+ assert (to_channel <= _channels);
float* s = from->data (from_channel);
float* d = _data[to_channel];
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 7ab72d9a1..61764a39d 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -271,7 +271,9 @@ Player::process_audio (weak_ptr<Piece> weak_piece, shared_ptr<const AudioBuffers
dcp_mapped->make_silent ();
list<pair<int, libdcp::Channel> > map = content->audio_mapping().content_to_dcp ();
for (list<pair<int, libdcp::Channel> >::iterator i = map.begin(); i != map.end(); ++i) {
- dcp_mapped->accumulate_channel (audio.get(), i->first, i->second);
+ if (i->first < audio->channels() && i->second < dcp_mapped->channels()) {
+ dcp_mapped->accumulate_channel (audio.get(), i->first, i->second);
+ }
}
audio = dcp_mapped;
diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h
index 876d66088..3d3f0c36c 100644
--- a/src/lib/sndfile_content.h
+++ b/src/lib/sndfile_content.h
@@ -17,6 +17,9 @@
*/
+#ifndef DVDOMATIC_SNDFILE_CONTENT_H
+#define DVDOMATIC_SNDFILE_CONTENT_H
+
extern "C" {
#include <libavutil/audioconvert.h>
}
@@ -76,3 +79,5 @@ private:
int _audio_frame_rate;
AudioMapping _audio_mapping;
};
+
+#endif