From 377d745ae9816be0fc1f618dc8de7d83235df1c9 Mon Sep 17 00:00:00 2001 From: eugeni Date: Fri, 29 Feb 2008 17:25:48 +0000 Subject: Set audio->sh correctly when switching audio tracks. The same for video tracks. Demuxers almost never update audio->sh or sub->sh when swithing tracks. It is especially bad when switching to no sound, and results in "too many audio packets" error. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26121 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demuxer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libmpdemux') diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 20a1fc44ed..857232abdd 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -1142,6 +1142,10 @@ int demuxer_switch_audio(demuxer_t *demuxer, int index){ int res = demux_control(demuxer, DEMUXER_CTRL_SWITCH_AUDIO, &index); if (res == DEMUXER_CTRL_NOTIMPL) index = demuxer->audio->id; + if (demuxer->audio->id >= 0) + demuxer->audio->sh = demuxer->a_streams[demuxer->audio->id]; + else + demuxer->audio->sh = NULL; return index; } @@ -1149,6 +1153,10 @@ int demuxer_switch_video(demuxer_t *demuxer, int index){ int res = demux_control(demuxer, DEMUXER_CTRL_SWITCH_VIDEO, &index); if (res == DEMUXER_CTRL_NOTIMPL) index = demuxer->video->id; + if (demuxer->video->id >= 0) + demuxer->video->sh = demuxer->v_streams[demuxer->video->id]; + else + demuxer->video->sh = NULL; return index; } -- cgit v1.2.3