Only pull audio in pass() if we are handling it.
authorCarl Hetherington <cth@carlh.net>
Sat, 3 Aug 2013 13:05:23 +0000 (14:05 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 3 Aug 2013 13:05:23 +0000 (14:05 +0100)
src/lib/player.cc

index ee044e4e12e59c54a12ab3ceddc01b4c5e0a2502..af2e6216a0f730321c6b3b8cc78f82bcb2d0ccb8 100644 (file)
@@ -209,18 +209,20 @@ Player::pass ()
                }
                break;
        }
-       
-       Time audio_done_up_to = TIME_MAX;
-       for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) {
-               if (dynamic_pointer_cast<AudioDecoder> ((*i)->decoder)) {
-                       audio_done_up_to = min (audio_done_up_to, (*i)->audio_position);
-               }
-       }
 
-       TimedAudioBuffers<Time> tb = _audio_merger.pull (audio_done_up_to);
-       Audio (tb.audio, tb.time);
-       _audio_position += _film->audio_frames_to_time (tb.audio->frames ());
+       if (_audio) {
+               Time audio_done_up_to = TIME_MAX;
+               for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) {
+                       if (dynamic_pointer_cast<AudioDecoder> ((*i)->decoder)) {
+                               audio_done_up_to = min (audio_done_up_to, (*i)->audio_position);
+                       }
+               }
 
+               TimedAudioBuffers<Time> tb = _audio_merger.pull (audio_done_up_to);
+               Audio (tb.audio, tb.time);
+               _audio_position += _film->audio_frames_to_time (tb.audio->frames ());
+       }
+               
 #ifdef DEBUG_PLAYER
        cout << "\tpost pass _video_position=" << _video_position << " _audio_position=" << _audio_position << "\n";
 #endif