Commit 04c94d37 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: use atomic variable instead of aout lock for statistics

parent 1b57d370
......@@ -75,8 +75,7 @@ typedef struct
aout_request_vout_t request_vout;
bool recycle_vout;
unsigned buffers_lost;
atomic_uint buffers_lost;
vlc_atomic_t restart;
} aout_owner_t;
......
......@@ -96,10 +96,10 @@ error:
date_Init (&owner->sync.date, owner->mixer_format.i_rate, 1);
date_Set (&owner->sync.date, VLC_TS_INVALID);
owner->sync.resamp_type = AOUT_RESAMPLING_NONE;
aout_unlock( p_aout );
owner->buffers_lost = 0;
atomic_init (&owner->buffers_lost, 0);
aout_unlock( p_aout );
return ret;
}
......@@ -317,7 +317,7 @@ int aout_DecPlay (audio_output_t *aout, block_t *block, int input_rate)
block = aout_FiltersPlay (aout, block, input_rate);
if (block == NULL)
{
owner->buffers_lost++;
atomic_fetch_add(&owner->buffers_lost, 1);
goto out;
}
......@@ -386,21 +386,14 @@ out:
return 0;
drop:
block_Release (block);
owner->buffers_lost++;
atomic_fetch_add(&owner->buffers_lost, 1);
goto out;
}
int aout_DecGetResetLost (audio_output_t *aout)
{
aout_owner_t *owner = aout_owner (aout);
unsigned val;
aout_lock (aout);
val = owner->buffers_lost;
owner->buffers_lost = 0;
aout_unlock (aout);
return val;
return atomic_exchange(&owner->buffers_lost, 0);
}
void aout_DecChangePause (audio_output_t *aout, bool paused, mtime_t date)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment