Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/src/st2110/pipeline/st22_pipeline_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static uint16_t rx_st22p_next_idx(struct st22p_rx_ctx* ctx, uint16_t idx) {
static void rx_st22p_block_wake(struct st22p_rx_ctx* ctx) {
/* notify block */
mt_pthread_mutex_lock(&ctx->block_wake_mutex);
ctx->block_wake_pending = true;
mt_pthread_cond_signal(&ctx->block_wake_cond);
mt_pthread_mutex_unlock(&ctx->block_wake_mutex);
}
Expand Down Expand Up @@ -600,9 +601,13 @@ struct st_frame* st22p_rx_get_frame(st22p_rx_handle handle) {
ST22P_RX_FRAME_DECODED, ST22P_RX_FRAME_IN_USER);
if (!framebuff && ctx->block_get) {
mt_pthread_mutex_lock(&ctx->block_wake_mutex);
if (!atomic_load_explicit(&ctx->lc_destroying, memory_order_acquire))
mt_pthread_cond_timedwait_ns(&ctx->block_wake_cond, &ctx->block_wake_mutex,
ctx->block_timeout_ns);
while (!ctx->block_wake_pending &&
!atomic_load_explicit(&ctx->lc_destroying, memory_order_acquire)) {
int _ret = mt_pthread_cond_timedwait_ns(
&ctx->block_wake_cond, &ctx->block_wake_mutex, ctx->block_timeout_ns);
if (_ret) break;
}
ctx->block_wake_pending = false;
mt_pthread_mutex_unlock(&ctx->block_wake_mutex);
if (atomic_load_explicit(&ctx->lc_destroying, memory_order_acquire)) goto out;
/* get again */
Expand Down
1 change: 1 addition & 0 deletions lib/src/st2110/pipeline/st22_pipeline_rx.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct st22p_rx_ctx {
pthread_cond_t block_wake_cond;
pthread_mutex_t block_wake_mutex;
uint64_t block_timeout_ns;
bool block_wake_pending;

struct st22_decode_session_impl* decode_impl;
/* for ST22_DECODER_RESP_FLAG_BLOCK_GET */
Expand Down
Loading