diff options
author | 2012-11-19 00:28:38 +0100 | |
---|---|---|
committer | 2012-11-20 18:00:15 +0100 | |
commit | 6f6dfc5163c3e1442f1c480e3dbd645ecd740eb5 (patch) | |
tree | 9ea44dbaf27b76de50bd5fc4f1a93ac7efb7996f | |
parent | 9085b85729bb8eb8e4b96195f651308e912b443f (diff) |
mplayer: fix potential issue when ao_play() fails
ao_play() can fail; in that case a negative error code is returned.
This error code is returned by write_to_ao() in turn. The function
fill_audio_out_buffers(), which calls write_to_ao(), doesn't check for
any error codes, and will likely trigger the assertion following the
function call. Change write_to_ao() to return 0 on failure to hopefully
prevent crashes when AOs fail.
-rw-r--r-- | core/mplayer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/mplayer.c b/core/mplayer.c index ebe52b1b76..1b07a0f9ee 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -2076,8 +2076,9 @@ static int write_to_ao(struct MPContext *mpctx, void *data, int len, int flags, // Keep correct pts for remaining data - could be used to flush // remaining buffer when closing ao. ao->pts += played / bps; + return played; } - return played; + return 0; } #define ASYNC_PLAY_DONE -3 |