projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/master' into 2.0
[dcpomatic.git]
/
src
/
lib
/
audio_decoder.cc
diff --git
a/src/lib/audio_decoder.cc
b/src/lib/audio_decoder.cc
index 12580c5f64972fd64498697e1f5dce7b4635af3d..f3251f306bf47284a71bc1d53917631e917c827b 100644
(file)
--- a/
src/lib/audio_decoder.cc
+++ b/
src/lib/audio_decoder.cc
@@
-17,6
+17,7
@@
*/
*/
+#include <iostream>
#include "audio_decoder.h"
#include "audio_buffers.h"
#include "audio_processor.h"
#include "audio_decoder.h"
#include "audio_buffers.h"
#include "audio_processor.h"
@@
-79,7
+80,7
@@
AudioDecoder::get_audio (AudioFrame frame, AudioFrame length, bool accurate)
*/
if (accurate) {
/* Keep stuffing data into _decoded_audio until we have enough data, or the subclass does not want to give us any more */
*/
if (accurate) {
/* Keep stuffing data into _decoded_audio until we have enough data, or the subclass does not want to give us any more */
- while (
_decoded_audio.frame > frame || (_decoded_audio.frame + _decoded_audio.audio->frames()) < end
&& !pass ()) {}
+ while (
(_decoded_audio.frame > frame || (_decoded_audio.frame + _decoded_audio.audio->frames()) < end)
&& !pass ()) {}
decoded_offset = frame - _decoded_audio.frame;
} else {
while (_decoded_audio.audio->frames() < length && !pass ()) {}
decoded_offset = frame - _decoded_audio.frame;
} else {
while (_decoded_audio.audio->frames() < length && !pass ()) {}
@@
-173,6
+174,13
@@
AudioDecoder::audio (shared_ptr<const AudioBuffers> data, ContentTime time)
void
AudioDecoder::add (shared_ptr<const AudioBuffers> data)
{
void
AudioDecoder::add (shared_ptr<const AudioBuffers> data)
{
+ if (!_audio_position) {
+ /* This should only happen when there is a seek followed by a flush, but
+ we need to cope with it.
+ */
+ return;
+ }
+
/* Resize _decoded_audio to fit the new data */
int new_size = 0;
if (_decoded_audio.audio->frames() == 0) {
/* Resize _decoded_audio to fit the new data */
int new_size = 0;
if (_decoded_audio.audio->frames() == 0) {