Changeset f3b93c6


Ignore:
Timestamp:
Dec 5, 2013, 3:40:34 PM (11 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
7760b40
Parents:
d75e2d5
Message:

src/io/source_avcodec.c: do not reuse AVPacket for now, avoiding memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    rd75e2d5 rf3b93c6  
    5454  AVCodecContext *avCodecCtx;
    5555  AVFrame *avFrame;
    56   AVPacket avPacket;
    5756  AVAudioResampleContext *avr;
    5857  int16_t *output;
     
    185184    AUBIO_ERR("Could not allocate frame for (%s)\n", s->path);
    186185  }
    187   AVPacket avPacket = s->avPacket;
    188   av_init_packet(&avPacket);
    189186
    190187  /* allocate output for avr */
     
    197194  s->avCodecCtx = avCodecCtx;
    198195  s->avFrame = avFrame;
    199   s->avPacket = avPacket;
    200196  s->avr = avr;
    201197
     
    215211  AVCodecContext *avCodecCtx = s->avCodecCtx;
    216212  AVFrame *avFrame = s->avFrame;
    217   AVPacket avPacket = s->avPacket;
     213  AVPacket avPacket;
     214  av_init_packet (&avPacket);
    218215  AVAudioResampleContext *avr = s->avr;
    219216  int16_t *output = s->output;
     
    263260  //  AUBIO_DBG("%f\n", SHORT_TO_FLOAT(output[i]));
    264261  //}
     262  av_free_packet(&avPacket);
    265263  s->avFormatCtx = avFormatCtx;
    266264  s->avCodecCtx = avCodecCtx;
    267265  s->avFrame = avFrame;
    268   s->avPacket = avPacket;
    269266  s->avr = avr;
    270267  s->output = output;
     
    345342  }
    346343  s->avFrame = NULL;
    347   if ( &(s->avPacket) != NULL) {
    348     av_free_packet( &(s->avPacket) );
    349   }
    350344  if (s->avCodecCtx != NULL) {
    351345    avcodec_close ( s->avCodecCtx );
Note: See TracChangeset for help on using the changeset viewer.