Changeset 7cc80b6 for src/io


Ignore:
Timestamp:
Nov 30, 2016, 4:35:55 PM (8 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, sampler, yinfft+
Children:
18a96aa
Parents:
57405c1
Message:

src/io/source_avcodec.c: replace with new context before closing old one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    r57405c1 r7cc80b6  
    238238    uint_t output_channels = multi ? s->input_channels : 1;
    239239    int64_t output_layout = av_get_default_channel_layout(output_channels);
    240     if (s->avr != NULL) {
    241       avresample_close( s->avr );
    242       av_free ( s->avr );
    243       s->avr = NULL;
    244     }
    245     AVAudioResampleContext *avr = s->avr;
    246     avr = avresample_alloc_context();
     240    AVAudioResampleContext *avr = avresample_alloc_context();
     241    AVAudioResampleContext *oldavr = s->avr;
    247242
    248243    av_opt_set_int(avr, "in_channel_layout",  input_layout,           0);
     
    268263    }
    269264    s->avr = avr;
     265    if (oldavr != NULL) {
     266      avresample_close( oldavr );
     267      av_free ( oldavr );
     268      oldavr = NULL;
     269    }
    270270    s->multi = multi;
    271271  }
Note: See TracChangeset for help on using the changeset viewer.