Increase number of frames stored in memory before write (#748).
authorCarl Hetherington <cth@carlh.net>
Mon, 21 Dec 2015 13:24:16 +0000 (13:24 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 21 Dec 2015 13:24:16 +0000 (13:24 +0000)
ChangeLog
src/lib/writer.cc

index 0cdf8131b337b706ba822b5dab9a07e847a253e6..ec4c1c98884d00cffd0bd1fcb6a0104bad856424 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2015-12-21  c.hetherington  <cth@carlh.net>
 
+       * Reduce frequency of temporary writes to disk (#748).
+
        * Use new Dolby website for both Doremi and Dolby certificates (#775).
 
 2015-12-18  c.hetherington  <cth@carlh.net>
index 93f5ed6d666d4395f16cf8ac09ce49dd84d50f0b..47c6b838142619a355cab1f0fbc298f84586df9b 100644 (file)
@@ -570,7 +570,16 @@ operator== (QueueItem const & a, QueueItem const & b)
 void
 Writer::set_encoder_threads (int threads)
 {
-       _maximum_frames_in_memory = lrint (threads * 1.1);
+       /* I think the scaling factor here should be the ratio of the longest frame
+          encode time to the shortest; if the thread count is T, longest time is L
+          and the shortest time S we could encode L/S frames per thread whilst waiting
+          for the L frame to encode so we might have to store LT/S frames.
+
+          However we don't want to use too much memory, so keep it a bit lower than we'd
+          perhaps like.  A J2K frame is typically about 1Mb so 3 here will mean we could
+          use about 240Mb with 72 encoding threads.
+       */
+       _maximum_frames_in_memory = lrint (threads * 3);
 }
 
 void