Fix incorrect reel lengths in some cases; account for emitted data being rejected...
[dcpomatic.git] / src / lib / audio_decoder.cc
index 5425798f6b615a9ec10a3de15a8200b97dcb0219..16a03a8e93593cdc5879f1e33f72c93742660ffb 100644 (file)
@@ -94,8 +94,7 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
                data = ro;
        }
 
-       Data (stream, ContentAudio (data, _positions[stream]));
-       _positions[stream] += data->frames();
+       _positions[stream] += Data(stream, ContentAudio (data, _positions[stream])).get_value_or(0);
 }
 
 /** @return Time just after the last thing that was emitted from a given stream */