summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-07-17 23:18:06 +0300
committerUoti Urpala <uau@mplayer2.org>2012-07-17 23:28:19 +0300
commit65b24e46a1c2f26688458cf16a11733e96da0f22 (patch)
tree7871127d2271eb35751519f1e5b5c3e22815bda0 /mplayer.c
parent2e8119be9a7474b3f86c53db044cfaa7ec27cbea (diff)
downloadmpv-65b24e46a1c2f26688458cf16a11733e96da0f22.tar.bz2
mpv-65b24e46a1c2f26688458cf16a11733e96da0f22.tar.xz
core: fix attempt to get audio pts without audio
written_audio_pts() can be called even if no audio track is active (at least through get_current_time() when there's no known video PTS). This triggered a crash due to NULL dereference. Add a check to return MP_NOPTS_VALUE if no audio track exists. Also remove a questionable update_osd_msg() call from per-file initialization code. The call was at a point where an audio track might be selected but not properly initialized, possibly also causing a crash if update_osd_msg() queries current position. I don't see any reason why the call would have been needed; it should get called anyway before OSD contents are actually used for the new file.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mplayer.c b/mplayer.c
index 5a2e7be1b3..2a87de2c2c 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1846,6 +1846,8 @@ init_error:
static double written_audio_pts(struct MPContext *mpctx)
{
sh_audio_t *sh_audio = mpctx->sh_audio;
+ if (!sh_audio)
+ return MP_NOPTS_VALUE;
demux_stream_t *d_audio = mpctx->d_audio;
// first calculate the end pts of audio that has been output by decoder
double a_pts = sh_audio->pts;
@@ -4817,10 +4819,8 @@ goto_enable_cache:
if (verbose)
opts->term_osd = 0;
- // Make sure old OSD does not stay around,
- // e.g. with -fixed-vo and same-resolution files
+ // Make sure old OSD does not stay around
clear_osd_msgs();
- update_osd_msg(mpctx);
//================ SETUP AUDIO ==========================