diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-11-04 21:32:55 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-11-04 21:32:55 +0000 |
| commit | 0801b4163c1c66061692fe24ef39cfffdfda462e (patch) | |
| tree | 39b16aaeaa6a96264300a1a9f9ba9298a7fdc175 /src/lib | |
| parent | 555b4068ff0e1726519d720b055a9faaca01a1a1 (diff) | |
Fix various bugs.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/decoder.cc | 4 | ||||
| -rw-r--r-- | src/lib/delay_line.cc | 1 | ||||
| -rw-r--r-- | src/lib/util.cc | 13 |
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)); } |
