diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-01-08 12:25:05 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-01-08 12:25:05 +0000 |
| commit | d45689e1552f21d2840c0fbeac3956319575db3d (patch) | |
| tree | dede4e33b0d36b6c78b1dc45b90d8aa7fb5e781d /src/lib | |
| parent | 0581cdaad9ca5ceeb67afdd6db8bc72661214b96 (diff) | |
Speculative fix for #305; ensure _queue.sort() happens before have_sequenced_image... in all cases (the second call to have_sequenced_image may have been called with an unsorted _queue, especially on quick machines).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/writer.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc index b26cd1f4d..5d53cbbe2 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -172,9 +172,7 @@ Writer::write (shared_ptr<const AudioBuffers> audio) _sound_asset_writer->write (audio->data(), audio->frames()); } -/** This must be called from Writer::thread() with an appropriate lock held, - * and with _queue sorted. - */ +/** This must be called from Writer::thread() with an appropriate lock held */ bool Writer::have_sequenced_image_at_queue_head () const { @@ -182,6 +180,8 @@ Writer::have_sequenced_image_at_queue_head () const return false; } + _queue.sort (); + /* The queue should contain only EYES_LEFT/EYES_RIGHT pairs or EYES_BOTH */ if (_queue.front().eyes == EYES_BOTH) { @@ -212,8 +212,6 @@ try while (1) { - _queue.sort (); - if (_finish || _queued_full_in_memory > _maximum_frames_in_memory || have_sequenced_image_at_queue_head ()) { break; } @@ -227,7 +225,7 @@ try return; } - /* Write any frames that we can write; i.e. those that are in sequence */ + /* Write any frames that we can write; i.e. those that are in sequence. */ while (have_sequenced_image_at_queue_head ()) { QueueItem qi = _queue.front (); _queue.pop_front (); |
