_audio_codec_name = "pcm_s24le";
av_dict_set_int (&_video_options, "crf", x264_crf, 0);
break;
+ default:
+ DCPOMATIC_ASSERT (false);
}
setup_video ();
AVFrame* frame = av_frame_alloc ();
DCPOMATIC_ASSERT (frame);
- _pending_images[image->data()[0]] = image;
+ {
+ boost::mutex::scoped_lock lm (_pending_images_mutex);
+ _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)
{
- _pending_images.erase (data);
+ boost::mutex::scoped_lock lm (_pending_images_mutex);
+ if (_pending_images.find(data) != _pending_images.end()) {
+ _pending_images.erase (data);
+ }
}