mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 07:12:39 +00:00
player: simplify error_on_track()
track can't be NLUL at this point, so the if is redundant. Remove it and unindent the block. Also, make the function check whether the track is selected at all, which makes it safer and idempotent.
This commit is contained in:
parent
1aa2ae5404
commit
242dbc6c2c
@ -163,10 +163,9 @@ void update_window_title(struct MPContext *mpctx, bool force)
|
|||||||
|
|
||||||
void error_on_track(struct MPContext *mpctx, struct track *track)
|
void error_on_track(struct MPContext *mpctx, struct track *track)
|
||||||
{
|
{
|
||||||
if (!track)
|
if (!track || !track->selected)
|
||||||
return;
|
return;
|
||||||
mp_deselect_track(mpctx, track);
|
mp_deselect_track(mpctx, track);
|
||||||
if (track) {
|
|
||||||
if (track->type == STREAM_AUDIO)
|
if (track->type == STREAM_AUDIO)
|
||||||
MP_INFO(mpctx, "Audio: no audio\n");
|
MP_INFO(mpctx, "Audio: no audio\n");
|
||||||
if (track->type == STREAM_VIDEO)
|
if (track->type == STREAM_VIDEO)
|
||||||
@ -180,7 +179,6 @@ void error_on_track(struct MPContext *mpctx, struct track *track)
|
|||||||
mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY;
|
mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY;
|
||||||
}
|
}
|
||||||
mpctx->sleeptime = 0;
|
mpctx->sleeptime = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int stream_dump(struct MPContext *mpctx, const char *source_filename)
|
int stream_dump(struct MPContext *mpctx, const char *source_filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user