mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
vo_gpu_next: fix crash when disabling DR at runtime
This code fails if we have DR buffers, but none of them correspond to the current frame. Normally only happens if e.g. changing the decoder at runtime, since DR buffers are not properly reinit in that case. (Arguably a separate bug)
This commit is contained in:
parent
803bcaa12b
commit
d936293c41
@ -159,17 +159,18 @@ static void update_lut(struct priv *p, struct user_lut *lut);
|
||||
|
||||
static pl_buf get_dr_buf(struct priv *p, const uint8_t *ptr)
|
||||
{
|
||||
pl_buf buf = NULL;
|
||||
pthread_mutex_lock(&p->dr_lock);
|
||||
|
||||
for (int i = 0; i < p->num_dr_buffers; i++) {
|
||||
buf = p->dr_buffers[i];
|
||||
if (ptr >= buf->data && ptr < buf->data + buf->params.size)
|
||||
break;
|
||||
pl_buf buf = p->dr_buffers[i];
|
||||
if (ptr >= buf->data && ptr < buf->data + buf->params.size) {
|
||||
pthread_mutex_unlock(&p->dr_lock);
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&p->dr_lock);
|
||||
return buf;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void free_dr_buf(void *opaque, uint8_t *data)
|
||||
|
Loading…
Reference in New Issue
Block a user