Skip to content

Commit 8c19440

Browse files
committed
vcap/file: missing lock
When playing single JPEG, the s->video_frame_queue got corrupted (.size() returned UINT_MAX).
1 parent a5067c3 commit 8c19440

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/video_capture/file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ static void vidcap_file_show_help(bool full) {
168168
}
169169

170170
static void flush_captured_data(struct vidcap_state_lavf_decoder *s) {
171+
pthread_mutex_lock(&s->lock);
171172
struct video_frame *f = NULL;
172173
while ((f = simple_linked_list_pop(s->video_frame_queue)) != NULL) {
173174
VIDEO_FRAME_DISPOSE(f);
@@ -185,6 +186,7 @@ static void flush_captured_data(struct vidcap_state_lavf_decoder *s) {
185186
avcodec_flush_buffers(s->aud_ctx);
186187
}
187188
s->audio_end_ts = AV_NOPTS_VALUE;
189+
pthread_mutex_unlock(&s->lock);
188190
}
189191

190192
static void vidcap_file_common_cleanup(struct vidcap_state_lavf_decoder *s) {

0 commit comments

Comments
 (0)