Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player/audio: invert audio_started boolean #14616

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion player/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ static void ao_chain_reset_state(struct ao_chain *ao_c)
ao_c->start_pts = MP_NOPTS_VALUE;
ao_c->untimed_throttle = false;
ao_c->underrun = false;
ao_c->delaying_audio_start = false;
}

void reset_audio_state(struct MPContext *mpctx)
Expand Down Expand Up @@ -841,12 +842,13 @@ void audio_start_ao(struct MPContext *mpctx)
MP_VERBOSE(mpctx, "delaying audio start %f vs. %f, diff=%f\n",
apts, pts, diff);
mpctx->logged_async_diff = diff;
ao_c->delaying_audio_start = true;
}
return;
}

MP_VERBOSE(mpctx, "starting audio playback\n");
ao_c->audio_started = true;
ao_c->delaying_audio_start = false;
ao_start(ao_c->ao);
mpctx->audio_status = STATUS_PLAYING;
if (ao_c->out_eof) {
Expand Down
2 changes: 1 addition & 1 deletion player/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ struct ao_chain {
double start_pts;
bool start_pts_known;

bool audio_started;
bool delaying_audio_start;
Dudemanguy marked this conversation as resolved.
Show resolved Hide resolved

struct track *track;
struct mp_pin *filter_src;
Expand Down
2 changes: 1 addition & 1 deletion player/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ static void handle_new_frame(struct MPContext *mpctx)
}
}
mpctx->time_frame += frame_time / mpctx->video_speed;
if (mpctx->ao_chain && mpctx->ao_chain->audio_started)
if (mpctx->ao_chain && !mpctx->ao_chain->delaying_audio_start)
mpctx->delay -= frame_time;
if (mpctx->video_status >= STATUS_PLAYING)
adjust_sync(mpctx, pts, frame_time);
Expand Down
Loading