Apply a modified version of 7c76bbb0c989cb5e5e552f28668a985243438cab
authorCarl Hetherington <cth@carlh.net>
Sat, 9 May 2015 21:59:07 +0000 (22:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 9 May 2015 21:59:07 +0000 (22:59 +0100)
from master; when we push an encoded frame's data to disk because we
can't write it yet, the idea i to set encoded in the QueueItem to 0
to say that the data has already been pushed to disk.

This was not working because we were resetting encoded in a copy of the QueueItem,
and hence not affecting the QueueItem held in _queue.

This meant that the same frame could be pushed to disk several times.

Use the iterator instead of a copy so that the QueueItem in the list
is modified.

ChangeLog
TO_PORT
src/lib/writer.cc

index 17a774ab5ef98ef995c5b2860c3c1dbd209bea8f..4a2a6bedd47f9dbed242e14dae5ad258546a56b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-05-09  Carl Hetherington  <cth@carlh.net>
 
+       * Efficiency fix for cases where there is a lot of processing
+       power.
+
        * Add UTF-8 content type to KDM emails to try to fix #549.
 
        * Disable OK until a download succeeds in the certificate
diff --git a/TO_PORT b/TO_PORT
index 1379650b315d085a239ebae3bbc92ac21ba83bb4..9f7668d51e89fb97d78fdabb75c54e024c401089 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1,8 +1,6 @@
-1d63d0309d071254fcf4da65d3710e94fadd38e8
-0c0211871d0be5b3409adfc88d2979ca5b439b0a
-wscript/cscript etc. cleanups
 2a3bfb06c68afd1aa4daaa14ece050689ea47927
 f248f57f745176349a5ac938842216954aab477e
 3eabb0b4eb8a2303ce4f7aa5ed2fd77645d803a8
 07d0be5e167b326caefb8e9981d99faf3823b15b
 0b3fb0ba4c841de950e6f62ddd3992925ca781c6
+wscript/cscript etc. cleanups
index 31c265e2f73e82a60a590d251e99b89c729027a6..1a11a482bf0b0155d948848474e5cc18333b0296 100644 (file)
@@ -366,21 +366,24 @@ try
                        }
 
                        DCPOMATIC_ASSERT (i != _queue.rend());
-                       QueueItem qi = *i;
-
                        ++_pushed_to_disk;
-                       
                        lock.unlock ();
 
+                       /* i is valid here, even though we don't hold a lock on the mutex,
+                          since list iterators are unaffected by insertion and only this
+                          thread could erase the last item in the list.
+                       */
+
                        LOG_GENERAL (
                                "Writer full (awaiting %1 [last eye was %2]); pushes %3 to disk",
                                _last_written_frame + 1,
-                               _last_written_eyes, qi.frame
+                               _last_written_eyes, i->frame
                                );
                        
-                       qi.encoded->write (_film, qi.frame, qi.eyes);
+                       i->encoded->write (_film, i->frame, i->eyes);
+                       
                        lock.lock ();
-                       qi.encoded.reset ();
+                       i->encoded.reset ();
                        --_queued_full_in_memory;
                }