File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
plugins/code/hevc_enc/ffmpeg/src Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 3333#include " hevc_enc_api.h"
3434#include " hevc_enc_ffmpeg_utils.h"
3535
36+ #define MAX_BUFFERED_PLANES 12
37+
3638static
3739const
3840property_info_t hevc_enc_ffmpeg_info[] =
@@ -201,11 +203,19 @@ ffmpeg_process
201203 return STATUS_ERROR;
202204 }
203205
204- state->data ->in_buffer_mutex .lock ();
205- state->data ->in_buffer .push_back (new BufferBlob (current_pic.plane [0 ], plane_0_size));
206- state->data ->in_buffer .push_back (new BufferBlob (current_pic.plane [1 ], plane_1_size));
207- state->data ->in_buffer .push_back (new BufferBlob (current_pic.plane [2 ], plane_2_size));
208- state->data ->in_buffer_mutex .unlock ();
206+ bool picture_written_flag = false ;
207+ while (state->data ->ffmpeg_thread .joinable () && picture_written_flag == false )
208+ {
209+ state->data ->in_buffer_mutex .lock ();
210+ if (state->data ->in_buffer .size () < MAX_BUFFERED_PLANES)
211+ {
212+ state->data ->in_buffer .push_back (new BufferBlob (current_pic.plane [0 ], plane_0_size));
213+ state->data ->in_buffer .push_back (new BufferBlob (current_pic.plane [1 ], plane_1_size));
214+ state->data ->in_buffer .push_back (new BufferBlob (current_pic.plane [2 ], plane_2_size));
215+ picture_written_flag = true ;
216+ }
217+ state->data ->in_buffer_mutex .unlock ();
218+ }
209219 }
210220
211221 state->data ->out_buffer_mutex .lock ();
You can’t perform that action at this time.
0 commit comments