Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
muxer libav: fix another memory leaks caused by wrong ffmpeg code
  • Loading branch information
perexg committed Oct 21, 2014
1 parent 15db6d1 commit 33449e8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/muxer/muxer_libav.c
Expand Up @@ -49,11 +49,15 @@ lav_muxer_write(void *opaque, uint8_t *buf, int buf_size)
{
int r;
lav_muxer_t *lm = (lav_muxer_t*)opaque;

r = write(lm->lm_fd, buf, buf_size);
lm->m_errors += (r != buf_size);
if (r != buf_size)
lm->m_errors++;

return r;
/* No room to notify about errors here. */
/* We need to complete av_write_trailer() to free */
/* all associated structures. */
return buf_size;
}


Expand Down Expand Up @@ -388,6 +392,9 @@ lav_muxer_write_pkt(muxer_t *m, streaming_message_type_t smt, void *data)
av_init_packet(&packet);

if(lm->lm_h264_filter && st->codec->codec_id == AV_CODEC_ID_H264) {
free_data = 1;
packet.data = NULL;
packet.size = 0;
if(av_bitstream_filter_filter(lm->lm_h264_filter,
st->codec,
NULL,
Expand All @@ -399,7 +406,6 @@ lav_muxer_write_pkt(muxer_t *m, streaming_message_type_t smt, void *data)
tvhlog(LOG_WARNING, "libav", "Failed to filter bitstream");
break;
}
free_data = 1;
} else if (st->codec->codec_id == AV_CODEC_ID_AAC) {
/* remove ADTS header */
packet.data = pktbuf_ptr(pkt->pkt_payload) + 7;
Expand Down

0 comments on commit 33449e8

Please sign in to comment.