summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-11-04 21:32:55 +0000
committerCarl Hetherington <cth@carlh.net>2012-11-04 21:32:55 +0000
commit0801b4163c1c66061692fe24ef39cfffdfda462e (patch)
tree39b16aaeaa6a96264300a1a9f9ba9298a7fdc175 /src/lib
parent555b4068ff0e1726519d720b055a9faaca01a1a1 (diff)
Fix various bugs.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/decoder.cc4
-rw-r--r--src/lib/delay_line.cc1
-rw-r--r--src/lib/util.cc13
3 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc
index 5860f339e..17e26905e 100644
--- a/src/lib/decoder.cc
+++ b/src/lib/decoder.cc
@@ -320,6 +320,8 @@ Decoder::process_video (AVFrame* frame)
emit_video (*i, sub);
}
+
+ ++_video_frames_in;
}
void
@@ -337,7 +339,7 @@ void
Decoder::emit_video (shared_ptr<Image> image, shared_ptr<Subtitle> sub)
{
TIMING ("Decoder emits %1", _video_frames_out);
- Video (image, _video_frames_out, sub);
+ Video (image, _video_frames_in, sub);
++_video_frames_out;
_last_image = image;
_last_subtitle = sub;
diff --git a/src/lib/delay_line.cc b/src/lib/delay_line.cc
index 8aa43e293..e7cd8dc94 100644
--- a/src/lib/delay_line.cc
+++ b/src/lib/delay_line.cc
@@ -31,6 +31,7 @@ using boost::shared_ptr;
* @param frames Delay in frames, +ve to move audio later.
*/
DelayLine::DelayLine (int channels, int frames)
+ : _negative_delay_remaining (0)
{
if (frames > 0) {
/* We need a buffer to keep some data in */
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 26b2877f7..5dd39c0e8 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -792,6 +792,19 @@ AudioBuffers::copy_from (AudioBuffers* from, int frames_to_copy, int read_offset
void
AudioBuffers::move (int from, int to, int frames)
{
+ if (frames == 0) {
+ return;
+ }
+
+ assert (from >= 0);
+ assert (from < _frames);
+ assert (to >= 0);
+ assert (to < _frames);
+ assert (frames > 0);
+ assert (frames <= _frames);
+ assert ((from + frames) <= _frames);
+ assert ((to + frames) <= _frames);
+
for (int i = 0; i < _channels; ++i) {
memmove (_data[i] + to, _data[i] + from, frames * sizeof(float));
}