AVFrame* frame = av_frame_alloc ();
DCPOMATIC_ASSERT (frame);
- _pending_images[image->data()[0]] = image;
+ {
+ boost::mutex::scoped_lock lm (_pending_images_mutex);
+ DCPOMATIC_ASSERT (_pending_images.find(image->data()[0]) != _pending_images.end());
+ _pending_images[image->data()[0]] = image;
+ }
+
for (int i = 0; i < 3; ++i) {
AVBufferRef* buffer = av_buffer_create(image->data()[i], image->stride()[i] * image->size().height, &buffer_free, this, 0);
frame->buf[i] = av_buffer_ref (buffer);
void
FFmpegFileEncoder::buffer_free2 (uint8_t* data)
{
- /* XXX: does this need a lock to prevent cross-thread access to _pending_images? */
+ boost::mutex::scoped_lock lm (_pending_images_mutex);
if (_pending_images.find(data) != _pending_images.end()) {
_pending_images.erase (data);
}
their data have been passed to FFmpeg.
*/
std::map<uint8_t*, boost::shared_ptr<const Image> > _pending_images;
+ boost::mutex _pending_images_mutex;
static int _video_stream_index;
static int _audio_stream_index;