Skip to content

Instantly share code, notes, and snippets.

Created March 16, 2018 19:51
Show Gist options
  • Save anonymous/2ce9b9a3ed9d575b8b986b99f64db181 to your computer and use it in GitHub Desktop.
Save anonymous/2ce9b9a3ed9d575b8b986b99f64db181 to your computer and use it in GitHub Desktop.
diff --git a/src/player.c b/src/player.c
index 9cbee69..8099bf0 100644
--- a/src/player.c
+++ b/src/player.c
@@ -145,8 +145,12 @@ static bool openStream (player_t * const player) {
player->fctx->interrupt_callback.callback = intCb;
player->fctx->interrupt_callback.opaque = player;
+ AVDictionary *options = NULL;
+ /* 10 seconds (in microseconds) timeout on TCP r/w */
+ av_dict_set (&options, "timeout", "10000000", 0);
+
assert (player->url != NULL);
- if ((ret = avformat_open_input (&player->fctx, player->url, NULL, NULL)) < 0) {
+ if ((ret = avformat_open_input (&player->fctx, player->url, NULL, &options)) < 0) {
softfail ("Unable to open audio file");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment