summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-04-04 08:06:55 -0400
committerKacper Michajłow <kasper93@gmail.com>2024-04-17 23:42:35 +0200
commitb7ad0968ad3e4fde2112b146c51eea7832b6bd8f (patch)
treedab0a6195218ff25fa149e30e3179a1573901328 /sub/dec_sub.c
parente731972163db1e00b3408692c88226ea3bf00814 (diff)
downloadmpv-b7ad0968ad3e4fde2112b146c51eea7832b6bd8f.tar.bz2
mpv-b7ad0968ad3e4fde2112b146c51eea7832b6bd8f.tar.xz
dec_sub: don't use recursive mutex
92a9f11a0b4fda60c8880014be5920dcf3e95253 added locking for dec_sub. At that time, because the lock was exposed to the outside world, a recursive mutex was used. However, this is no longer true after e9e883e3b2a64867aae014fb8a1416d0177fe493, when the public locking functions were removed. This means that the lock is now private. Unlike input.c, dec_sub already enforces said call hierarchy, so combined with the aforementioned change, the lock is only ever called once and never recursively. Thus the lock can be converted to a normal mutex.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index dab5abc69a..a8746a27ed 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -123,7 +123,7 @@ static void wakeup_demux(void *ctx)
mp_dispatch_interrupt(q);
}
-static void sub_destroy_cached_pkts(struct dec_sub *sub)
+static void destroy_cached_pkts(struct dec_sub *sub)
{
int index = 0;
while (index < sub->num_cached_pkts) {
@@ -204,7 +204,7 @@ struct dec_sub *sub_create(struct mpv_global *global, struct track *track,
};
sub->opts = sub->opts_cache->opts;
sub->shared_opts = sub->shared_opts_cache->opts;
- mp_mutex_init_type(&sub->lock, MP_MUTEX_RECURSIVE);
+ mp_mutex_init(&sub->lock);
sub->sd = init_decoder(sub);
if (sub->sd) {
@@ -476,7 +476,7 @@ void sub_reset(struct dec_sub *sub)
sub->sd->driver->reset(sub->sd);
sub->last_pkt_pts = MP_NOPTS_VALUE;
sub->last_vo_pts = MP_NOPTS_VALUE;
- sub_destroy_cached_pkts(sub);
+ destroy_cached_pkts(sub);
TA_FREEP(&sub->new_segment);
mp_mutex_unlock(&sub->lock);
}