Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
libav muxer: fix the close sequence for live file descriptors, issue …
…#4704, fixes #4712
  • Loading branch information
perexg committed Nov 8, 2017
1 parent ebabde7 commit aefc4d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/muxer/muxer_libav.c
Expand Up @@ -401,6 +401,7 @@ lav_muxer_open_file(muxer_t *m, const char *filename)
char buf[256];
int r;

lm->lm_fd = -1;
oc = lm->lm_oc;
snprintf(oc->filename, sizeof(oc->filename), "%s", filename);

Expand Down Expand Up @@ -566,8 +567,13 @@ lav_muxer_close(muxer_t *m)
}

oc = lm->lm_oc;
avio_close(oc->pb);
oc->pb=NULL;
if (lm->lm_fd >= 0) {
av_freep(&oc->pb->buffer);
avio_context_free(&oc->pb);
lm->lm_fd = -1;
} else {
avio_closep(&oc->pb);
}

return ret;
}
Expand Down

0 comments on commit aefc4d0

Please sign in to comment.