Skip to content

Commit

Permalink
picture_pool: change picture_pool_Cancel arguments
Browse files Browse the repository at this point in the history
Add a boolean to reset the cancel state to false.
  • Loading branch information
tguillem committed Dec 21, 2015
1 parent 65d2345 commit 7ae0410
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/vlc_picture_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ unsigned picture_pool_Reset( picture_pool_t * );
/**
* Cancel the picture pool.
*
* It won't return any pictures via picture_pool_Get or picture_pool_Wait after
* this call. This function will also unblock picture_pool_Wait. Call
* picture_pool_Reset to reset the cancel state.
* It won't return any pictures via picture_pool_Get or picture_pool_Wait if
* canceled is true. This function will also unblock picture_pool_Wait.
* picture_pool_Reset will also reset the cancel state to false.
*/
void picture_pool_Cancel( picture_pool_t * );
void picture_pool_Cancel( picture_pool_t *, bool canceled );

/**
* Reserves pictures from a pool and creates a new pool with those.
Expand Down
7 changes: 4 additions & 3 deletions src/misc/picture_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,14 @@ picture_t *picture_pool_Wait(picture_pool_t *pool)
return clone;
}

void picture_pool_Cancel(picture_pool_t *pool)
void picture_pool_Cancel(picture_pool_t *pool, bool canceled)
{
vlc_mutex_lock(&pool->lock);
assert(pool->refs > 0);

pool->canceled = true;
vlc_cond_broadcast(&pool->wait);
pool->canceled = canceled;
if (canceled)
vlc_cond_broadcast(&pool->wait);
vlc_mutex_unlock(&pool->lock);
}

Expand Down
2 changes: 1 addition & 1 deletion src/video_output/video_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ static int ThreadReinit(vout_thread_t *vout,

static void ThreadCancel(vout_thread_t *vout)
{
picture_pool_Cancel(vout->p->decoder_pool);
picture_pool_Cancel(vout->p->decoder_pool, true);
}

static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
Expand Down

0 comments on commit 7ae0410

Please sign in to comment.