Use SafeStringStream instead of std::stringstream to try to fix random crashes on...
[dcpomatic.git] / src / lib / player.cc
index 20cea7e4a482bc9da9a4d9b134daf032b8790441..2d2977606786097f6b827ec07a8048dd7c90da59 100644 (file)
@@ -95,7 +95,7 @@ Player::pass ()
        } type = VIDEO;
 
        for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) {
-               if ((*i)->decoder->done ()) {
+               if ((*i)->decoder->done () || (*i)->content->length_after_trim() == 0) {
                        continue;
                }
 
@@ -150,7 +150,12 @@ Player::pass ()
                                if (re) {
                                        shared_ptr<const AudioBuffers> b = re->flush ();
                                        if (b->frames ()) {
-                                               process_audio (earliest, b, ac->audio_length (), true);
+                                               process_audio (
+                                                       earliest,
+                                                       b,
+                                                       ac->audio_length() * ac->output_audio_frame_rate() / ac->content_audio_frame_rate(),
+                                                       true
+                                                       );
                                        }
                                }
                        }