I am using the master branch for stream transcoding, reading from memory and 
sending the transcoded packets to the memory. To accomplish that, I use two 
AVIOContext variables to feed into input and output AVFormatContext.

I ran into a memory leak after I free all the things I allocated. I traced 
further, and noticed this in the aviobuf.c.
Note the avio_alloc_context actually allocates the superceding struct 
FFIOContext, and only returns an element (&s->pub) from FFIOContext.

The question naturally is how am I going to free FFIOContext, not just 
AVIOConect to plug the memory leak here?

AVIOContext *avio_alloc_context(
                  unsigned char *buffer,
                  int buffer_size,
                  int write_flag,
                  void *opaque,
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
{
    FFIOContext *s = av_malloc(sizeof(*s));
    if (!s)
        return NULL;
    ffio_init_context(s, buffer, buffer_size, write_flag, opaque,
                  read_packet, write_packet, seek);
    return &s->pub;
}

Thanks,
Zed Zhang
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to