deps/media-playback: Initialize mutex earlier for cached media

mp_cache_stop / mp_cache_free both try to use the mutex so we need to
make sure it's initialized before calling functions that may fail.
This commit is contained in:
Richard Stanway
2023-04-29 11:30:01 -07:00
committed by Jim
parent dba6544265
commit 7ceb39bd56
+3 -1
View File
@@ -560,6 +560,9 @@ bool mp_cache_init(mp_cache_t *c, const struct mp_media_info *info)
info2.full_decode = true;
mp_media_t *m = &c->m;
pthread_mutex_init_value(&c->mutex);
if (!mp_media_init(m, &info2)) {
mp_cache_free(c);
return false;
@@ -569,7 +572,6 @@ bool mp_cache_init(mp_cache_t *c, const struct mp_media_info *info)
return false;
}
pthread_mutex_init_value(&c->mutex);
c->opaque = info->opaque;
c->v_cb = info->v_cb;
c->a_cb = info->a_cb;