mirror of
https://github.com/mpv-player/mpv
synced 2025-01-02 21:12:23 +00:00
player: remove redundant variable
mpctx->audio_delay always has the same value as opts->audio_delay. (This was not the case a long time ago, when the audio-delay property didn't actually write to opts->audio_delay. I think.)
This commit is contained in:
parent
34d3a27f28
commit
86d4094b98
@ -420,7 +420,7 @@ static bool get_sync_samples(struct MPContext *mpctx, int *skip)
|
||||
}
|
||||
|
||||
if (sync_to_video)
|
||||
sync_pts -= mpctx->audio_delay - mpctx->delay;
|
||||
sync_pts -= opts->audio_delay - mpctx->delay;
|
||||
|
||||
double ptsdiff = written_pts - sync_pts;
|
||||
// Missing timestamp, or PTS reset, or just broken.
|
||||
@ -560,7 +560,7 @@ static void do_fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
|
||||
int playflags = 0;
|
||||
|
||||
if (endpts != MP_NOPTS_VALUE) {
|
||||
double samples = (endpts - written_audio_pts(mpctx) - mpctx->audio_delay)
|
||||
double samples = (endpts - written_audio_pts(mpctx) - opts->audio_delay)
|
||||
* play_samplerate;
|
||||
if (playsize > samples) {
|
||||
playsize = MPMAX(samples, 0);
|
||||
|
@ -1583,8 +1583,8 @@ static int mp_property_audio_delay(void *ctx, struct m_property *prop,
|
||||
*(char **)arg = format_delay(delay);
|
||||
return M_PROPERTY_OK;
|
||||
case M_PROPERTY_SET:
|
||||
mpctx->audio_delay = mpctx->opts->audio_delay = *(float *)arg;
|
||||
mpctx->delay += mpctx->audio_delay - delay;
|
||||
mpctx->opts->audio_delay = *(float *)arg;
|
||||
mpctx->delay += mpctx->opts->audio_delay - delay;
|
||||
return M_PROPERTY_OK;
|
||||
}
|
||||
return mp_property_generic_option(mpctx, prop, action, arg);
|
||||
|
@ -276,8 +276,6 @@ typedef struct MPContext {
|
||||
uint64_t backstep_start_seek_ts;
|
||||
bool backstep_active;
|
||||
|
||||
double audio_delay;
|
||||
|
||||
double next_heartbeat;
|
||||
double last_idle_tick;
|
||||
double next_cache_update;
|
||||
|
@ -950,7 +950,6 @@ static void play_current_file(struct MPContext *mpctx)
|
||||
mpctx->paused_for_cache = false;
|
||||
mpctx->playing_msg_shown = false;
|
||||
mpctx->backstep_active = false;
|
||||
mpctx->audio_delay = 0;
|
||||
mpctx->max_frames = -1;
|
||||
mpctx->seek = (struct seek_params){ 0 };
|
||||
|
||||
@ -987,7 +986,6 @@ static void play_current_file(struct MPContext *mpctx)
|
||||
load_per_file_options(mpctx->mconfig, mpctx->playing->params,
|
||||
mpctx->playing->num_params);
|
||||
|
||||
mpctx->audio_delay = opts->audio_delay;
|
||||
mpctx->max_frames = opts->play_frames;
|
||||
|
||||
MP_INFO(mpctx, "Playing: %s\n", mpctx->filename);
|
||||
|
@ -528,7 +528,7 @@ static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time
|
||||
if (mpctx->audio_status != STATUS_PLAYING)
|
||||
return;
|
||||
|
||||
double a_pts = written_audio_pts(mpctx) + mpctx->audio_delay - mpctx->delay;
|
||||
double a_pts = written_audio_pts(mpctx) + opts->audio_delay - mpctx->delay;
|
||||
double av_delay = a_pts - v_pts;
|
||||
|
||||
double change = av_delay * 0.1;
|
||||
@ -704,6 +704,8 @@ static void update_avsync_before_frame(struct MPContext *mpctx)
|
||||
// Update the A/V sync difference after a video frame has been shown.
|
||||
static void update_avsync_after_frame(struct MPContext *mpctx)
|
||||
{
|
||||
struct MPOpts *opts = mpctx->opts;
|
||||
|
||||
mpctx->time_frame -= get_relative_time(mpctx);
|
||||
mpctx->last_av_difference = 0;
|
||||
|
||||
@ -713,10 +715,9 @@ static void update_avsync_after_frame(struct MPContext *mpctx)
|
||||
|
||||
double a_pos = playing_audio_pts(mpctx);
|
||||
|
||||
mpctx->last_av_difference = a_pos - mpctx->video_pts + mpctx->audio_delay;
|
||||
mpctx->last_av_difference = a_pos - mpctx->video_pts + opts->audio_delay;
|
||||
if (mpctx->time_frame > 0)
|
||||
mpctx->last_av_difference +=
|
||||
mpctx->time_frame * mpctx->opts->playback_speed;
|
||||
mpctx->last_av_difference += mpctx->time_frame * opts->playback_speed;
|
||||
if (a_pos == MP_NOPTS_VALUE || mpctx->video_pts == MP_NOPTS_VALUE)
|
||||
mpctx->last_av_difference = MP_NOPTS_VALUE;
|
||||
if (mpctx->last_av_difference > 0.5 && !mpctx->drop_message_shown) {
|
||||
|
Loading…
Reference in New Issue
Block a user