summaryrefslogtreecommitdiff
path: root/src/lib/matcher.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-07 10:20:51 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-07 10:20:51 +0100
commit213f1b6c74585a16ea48bdeb550dbc6d11bb0f74 (patch)
treefeb0daef138128f8f5f1a919a4134bba017f6381 /src/lib/matcher.cc
parent4ff5c21a9c3c2ea8ab3a253ef5658e3ee91e0bea (diff)
Revert "Fix another bit of incorrect logic (this_is_first_audio was inverted). Also try to add _audio_starts_with_video mode to Matcher."
This reverts commit 4ff5c21a9c3c2ea8ab3a253ef5658e3ee91e0bea.
Diffstat (limited to 'src/lib/matcher.cc')
-rw-r--r--src/lib/matcher.cc28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/lib/matcher.cc b/src/lib/matcher.cc
index 3776d4fbc..2723f2a2d 100644
--- a/src/lib/matcher.cc
+++ b/src/lib/matcher.cc
@@ -34,6 +34,7 @@ Matcher::Matcher (shared_ptr<Log> log, int sample_rate, float frames_per_second)
, _frames_per_second (frames_per_second)
, _video_frames (0)
, _audio_frames (0)
+ , _had_first_video (false)
, _had_first_audio (false)
{
@@ -51,11 +52,8 @@ Matcher::process_video (boost::shared_ptr<const Image> image, bool same, boost::
_first_input = t;
}
- bool const this_is_first_video = !_first_video;
-
- if (!_first_video) {
- _first_video = t;
- }
+ bool const this_is_first_video = !_had_first_video;
+ _had_first_video = true;
if (this_is_first_video && _had_first_audio) {
/* First video since we got audio */
@@ -106,13 +104,13 @@ Matcher::process_audio (boost::shared_ptr<const AudioBuffers> b, double t)
_first_input = t;
}
- bool const this_is_first_audio = !_had_first_audio;
+ bool const this_is_first_audio = _had_first_audio;
_had_first_audio = true;
- if (!_first_video) {
+ if (!_had_first_video) {
/* No video yet; we must postpone these data until we have some */
_pending_audio.push_back (AudioRecord (b, t));
- } else if (this_is_first_audio && _first_video) {
+ } else if (this_is_first_audio && _had_first_video) {
/* First audio since we got video */
_pending_audio.push_back (AudioRecord (b, t));
fix_start (_first_input.get ());
@@ -147,11 +145,6 @@ Matcher::fix_start (double first_video)
match (first_video - _pending_audio.front().time);
for (list<AudioRecord>::iterator i = _pending_audio.begin(); i != _pending_audio.end(); ++i) {
- if (_audio_starts_with_video) {
- assert (_first_video);
- assert (_first_audio);
- i->time += _first_video.get() - _first_audio.get();
- }
process_audio (i->audio, i->time);
}
@@ -218,12 +211,3 @@ Matcher::repeat_last_video ()
++_video_frames;
}
-/** Set `audio starts with video' behaviour. If this is enabled,
- * audio time stamps are adjusted so that the first audio is synced
- * with the first video.
- */
-void
-Matcher::set_audio_starts_with_video (bool a)
-{
- _audio_starts_with_video = a;
-}