From 84270e2d1811924f1abc3917739d8d55c69611d4 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 2 Mar 2019 17:01:52 +0100 Subject: [PATCH] Rename "stop" to "interrupt" The purpose of video_buffer_stop() is to interrupt any blocking call, so rename it to video_buffer_interrupt(). --- app/src/decoder.c | 2 +- app/src/video_buffer.c | 8 ++++---- app/src/video_buffer.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/decoder.c b/app/src/decoder.c index adc59a30..a4a5beca 100644 --- a/app/src/decoder.c +++ b/app/src/decoder.c @@ -317,7 +317,7 @@ SDL_bool decoder_start(struct decoder *decoder) { } void decoder_stop(struct decoder *decoder) { - video_buffer_stop(decoder->video_buffer); + video_buffer_interrupt(decoder->video_buffer); } void decoder_join(struct decoder *decoder) { diff --git a/app/src/video_buffer.c b/app/src/video_buffer.c index f2a288d4..248b450a 100644 --- a/app/src/video_buffer.c +++ b/app/src/video_buffer.c @@ -27,7 +27,7 @@ SDL_bool video_buffer_init(struct video_buffer *vb) { SDL_DestroyMutex(vb->mutex); goto error_2; } - vb->stopped = SDL_FALSE; + vb->interrupted = SDL_FALSE; #endif // there is initially no rendering frame, so consider it has already been @@ -65,7 +65,7 @@ SDL_bool video_buffer_offer_decoded_frame(struct video_buffer *vb) { #ifndef SKIP_FRAMES // if SKIP_FRAMES is disabled, then the decoder must wait for the current // frame to be consumed - while (!vb->rendering_frame_consumed && !vb->stopped) { + while (!vb->rendering_frame_consumed && !vb->interrupted) { cond_wait(vb->rendering_frame_consumed_cond, vb->mutex); } #else @@ -97,12 +97,12 @@ const AVFrame *video_buffer_consume_rendered_frame(struct video_buffer *vb) { return vb->rendering_frame; } -void video_buffer_stop(struct video_buffer *vb) { +void video_buffer_interrupt(struct video_buffer *vb) { #ifdef SKIP_FRAMES (void) vb; // unused #else mutex_lock(vb->mutex); - vb->stopped = SDL_TRUE; + vb->interrupted = SDL_TRUE; mutex_unlock(vb->mutex); // wake up blocking wait cond_signal(vb->rendering_frame_consumed_cond); diff --git a/app/src/video_buffer.h b/app/src/video_buffer.h index 5c19557d..4ad422f8 100644 --- a/app/src/video_buffer.h +++ b/app/src/video_buffer.h @@ -15,7 +15,7 @@ struct video_buffer { AVFrame *rendering_frame; SDL_mutex *mutex; #ifndef SKIP_FRAMES - SDL_bool stopped; + SDL_bool interrupted; SDL_cond *rendering_frame_consumed_cond; #endif SDL_bool rendering_frame_consumed; @@ -37,6 +37,6 @@ SDL_bool video_buffer_offer_decoded_frame(struct video_buffer *vb); const AVFrame *video_buffer_consume_rendered_frame(struct video_buffer *vb); // wake up and avoid any blocking call -void video_buffer_stop(struct video_buffer *vb); +void video_buffer_interrupt(struct video_buffer *vb); #endif