summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-11-06 15:56:30 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-11-06 15:56:30 +0000
commitfefbdf991b0427c3b32d9333fedccdaf91a9a50e (patch)
treedb497b5d957151ae79e76e6a5bebc53368bc86ae
parentc6b1e6880b39160b1a37ab0b4fc0c3ca29ff7367 (diff)
downloadmpv-fefbdf991b0427c3b32d9333fedccdaf91a9a50e.tar.bz2
mpv-fefbdf991b0427c3b32d9333fedccdaf91a9a50e.tar.xz
Disable audio when initializing the filter chain fails (can happen e.g. when the hwmpa
decoder is used but the hardware does not support hardware MPEG audio). Otherwise this will lead to a crash later on when the decode code tries to access the audio filter chain. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29836 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--mplayer.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/mplayer.c b/mplayer.c
index 3ac29d322e..52b5fd3285 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1642,10 +1642,7 @@ if(mpctx->sh_audio){
ao_data.format,0))){
// FAILED:
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO);
- uninit_player(INITIALIZED_ACODEC); // close codec
- mpctx->sh_audio=mpctx->d_audio->sh=NULL; // -> nosound
- mpctx->d_audio->id = -2;
- return;
+ goto init_error;
} else {
// SUCCESS:
initialized_flags|=INITIALIZED_AO;
@@ -1663,15 +1660,19 @@ if(mpctx->sh_audio){
current_module="af_init";
if(!build_afilter_chain(mpctx->sh_audio, &ao_data)) {
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_NoMatchingFilter);
-// mp_msg(MSGT_CPLAYER,MSGL_ERR,"Couldn't find matching filter / ao format! -> NOSOUND\n");
-// uninit_player(INITIALIZED_ACODEC|INITIALIZED_AO); // close codec & ao
-// sh_audio=mpctx->d_audio->sh=NULL; // -> nosound
+ goto init_error;
}
#endif
}
mpctx->mixer.audio_out = mpctx->audio_out;
mpctx->mixer.volstep = volstep;
}
+return;
+
+init_error:
+ uninit_player(INITIALIZED_ACODEC|INITIALIZED_AO); // close codec and possibly AO
+ mpctx->sh_audio=mpctx->d_audio->sh=NULL; // -> nosound
+ mpctx->d_audio->id = -2;
}