ao: rename playthread to ao_thread

"playthread" is a confusing name which doesn't describe what it really
is. Rename it to ao_thread, and ao_wakeup_playthread to ao_wakeup,
in the same style as VO threads. This makes call stack function names
less confusing.
This commit is contained in:
nanahi 2024-04-10 01:12:40 -04:00 committed by Kacper Michajłow
parent 89cc477ef1
commit 06f88dfb3a
5 changed files with 17 additions and 17 deletions

View File

@ -547,7 +547,7 @@ error:
return -1;
}
static MP_THREAD_VOID playthread(void *arg)
static MP_THREAD_VOID ao_thread(void *arg)
{
struct ao *ao = arg;
struct priv *p = ao->priv;
@ -766,7 +766,7 @@ static int init(struct ao *ao)
goto error;
}
if (mp_thread_create(&p->thread, playthread, ao)) {
if (mp_thread_create(&p->thread, ao_thread, ao)) {
MP_ERR(ao, "pthread creation failed\n");
goto error;
}

View File

@ -118,7 +118,7 @@ static void stream_request_cb(pa_stream *s, size_t length, void *userdata)
{
struct ao *ao = userdata;
struct priv *priv = ao->priv;
ao_wakeup_playthread(ao);
ao_wakeup(ao);
pa_threaded_mainloop_signal(priv->mainloop, 0);
}
@ -135,7 +135,7 @@ static void underflow_cb(pa_stream *s, void *userdata)
struct priv *priv = ao->priv;
priv->playing = false;
priv->underrun_signalled = true;
ao_wakeup_playthread(ao);
ao_wakeup(ao);
pa_threaded_mainloop_signal(priv->mainloop, 0);
}

View File

@ -303,7 +303,7 @@ static void get_state(struct ao *ao, struct mp_pcm_state *state)
state->free_samples, state->queued_samples, state->delay);
p->playing = false;
state->playing = p->playing;
ao_wakeup_playthread(ao);
ao_wakeup(ao);
} else {
state->playing = p->playing;
}

View File

@ -41,7 +41,7 @@ struct buffer_state {
mp_mutex lock;
mp_cond wakeup;
// Playthread sleep
// AO thread sleep
mp_mutex pt_lock;
mp_cond pt_wakeup;
@ -83,9 +83,9 @@ struct buffer_state {
bool terminate; // exit thread
};
static MP_THREAD_VOID playthread(void *arg);
static MP_THREAD_VOID ao_thread(void *arg);
void ao_wakeup_playthread(struct ao *ao)
void ao_wakeup(struct ao *ao)
{
struct buffer_state *p = ao->buffer_state;
mp_mutex_lock(&p->pt_lock);
@ -352,7 +352,7 @@ void ao_reset(struct ao *ao)
ao->driver->reset(ao);
if (wakeup)
ao_wakeup_playthread(ao);
ao_wakeup(ao);
}
// Initiate playback. This moves from the stop/underrun state to actually
@ -379,7 +379,7 @@ void ao_start(struct ao *ao)
if (do_start)
ao->driver->start(ao);
ao_wakeup_playthread(ao);
ao_wakeup(ao);
}
void ao_set_paused(struct ao *ao, bool paused, bool eof)
@ -448,7 +448,7 @@ void ao_set_paused(struct ao *ao, bool paused, bool eof)
}
if (wakeup)
ao_wakeup_playthread(ao);
ao_wakeup(ao);
}
// Whether audio is playing. This means that there is still data in the buffers,
@ -503,7 +503,7 @@ void ao_drain(struct ao *ao)
static void wakeup_filters(void *ctx)
{
struct ao *ao = ctx;
ao_wakeup_playthread(ao);
ao_wakeup(ao);
}
void ao_uninit(struct ao *ao)
@ -578,7 +578,7 @@ bool init_buffer_post(struct ao *ao)
mp_filter_graph_set_wakeup_cb(p->filter_root, wakeup_filters, ao);
p->thread_valid = true;
if (mp_thread_create(&p->thread, playthread, ao)) {
if (mp_thread_create(&p->thread, ao_thread, ao)) {
p->thread_valid = false;
return false;
}
@ -701,7 +701,7 @@ eof:
return true;
}
static MP_THREAD_VOID playthread(void *arg)
static MP_THREAD_VOID ao_thread(void *arg)
{
struct ao *ao = arg;
struct buffer_state *p = ao->buffer_state;
@ -748,6 +748,6 @@ void ao_unblock(struct ao *ao)
mp_mutex_lock(&p->lock);
p->initial_unblocked = true;
mp_mutex_unlock(&p->lock);
ao_wakeup_playthread(ao);
ao_wakeup(ao);
}
}

View File

@ -159,7 +159,7 @@ struct ao_driver {
bool (*set_pause)(struct ao *ao, bool paused);
// pull based: start the audio callback
// push based: start playing queued data
// AO should call ao_wakeup_playthread() if a period boundary
// AO should call ao_wakeup() if a period boundary
// is crossed, or playback stops due to external reasons
// (including underruns or device removal)
// must set mp_pcm_state.playing; unset on error/underrun/end
@ -231,7 +231,7 @@ bool ao_can_convert_inplace(struct ao_convert_fmt *fmt);
bool ao_need_conversion(struct ao_convert_fmt *fmt);
void ao_convert_inplace(struct ao_convert_fmt *fmt, void **data, int num_samples);
void ao_wakeup_playthread(struct ao *ao);
void ao_wakeup(struct ao *ao);
int ao_read_data_converted(struct ao *ao, struct ao_convert_fmt *fmt,
void **data, int samples, int64_t out_time_ns);