Created
August 24, 2015 14:14
-
-
Save anonymous/b58e5abca81e96a3fa57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/player.c b/src/player.c | |
index 0ba0f36..84d55c6 100644 | |
--- a/src/player.c | |
+++ b/src/player.c | |
@@ -375,8 +375,15 @@ static int play (player_t * const player) { | |
const int numChannels = av_get_channel_layout_nb_channels ( | |
filteredFrame->channel_layout); | |
const int bps = av_get_bytes_per_sample(filteredFrame->format); | |
- ao_play (player->aoDev, (char *) filteredFrame->data[0], | |
- filteredFrame->nb_samples * numChannels * bps); | |
+ if (ao_play (player->aoDev, (char *) filteredFrame->data[0], | |
+ filteredFrame->nb_samples * numChannels * bps) == 0) { | |
+ /* error occured, try resetting the device */ | |
+ ao_close (player->aoDev); | |
+ if (!openDevice (player)) { | |
+ /* XXX: leaks memory */ | |
+ return AVERROR_UNKNOWN; | |
+ } | |
+ } | |
avfilter_unref_bufferp (&audioref); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment