[hatari-devel] Re: Threading PNG saving in AVI recording |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
On tiistai 16 huhtikuu 2013, Anders Eriksson wrote:
> For recording perfomance, the PNG saving would be wonderful to spread out
> on multithreading. PNG saving is by far the most costly during recording
> and all cores except one are idle.
That's a good idea.
Best place to drive that thread seems to b Avi_RecordVideoStream()
in avi_record.c.
However, you need to:
* take a copy of the screen contents before calling the PNG saving
(and giving the copied surface for that), otherwise it's not correct
for rest of Hatari to proceed (and update screen contents) in
the meanwhile.
* use locking to serialize that operation.
* use (same) locking to prevent rest of the AVI recording functionality
from writing to the file before PNG frame is finished, at least in:
- Avi_RecordAudioStream()
- Avi_StopRecording()
If Audio is written right before PNG data, instead of right after,
this may actually speed up things, instead of just complicating
the code.
Tested patches for this are welcome! :-)
- Eero