Changeset 41b4421


Ignore:
Timestamp:
Feb 26, 2017, 11:37:01 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
Children:
4d44531
Parents:
05a8c18
Message:

src/io/source_avcodec.c: avoid seeking in closed file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    r05a8c18 r41b4421  
    478478  int64_t max_ts = MIN(resampled_pos + 2000, INT64_MAX);
    479479  int seek_flags = AVSEEK_FLAG_FRAME | AVSEEK_FLAG_ANY;
    480   int ret = avformat_seek_file(s->avFormatCtx, s->selected_stream,
     480  int ret = AUBIO_FAIL;
     481  if (s->avFormatCtx != NULL && s->avr != NULL) {
     482    ret = AUBIO_OK;
     483  } else {
     484    AUBIO_ERR("source_avcodec: failed seeking in %s (file not opened?)", s->path);
     485    return ret;
     486  }
     487  ret = avformat_seek_file(s->avFormatCtx, s->selected_stream,
    481488      min_ts, resampled_pos, max_ts, seek_flags);
    482489  if (ret < 0) {
    483     AUBIO_ERR("Failed seeking to %d in file %s", pos, s->path);
     490    AUBIO_ERR("source_avcodec: failed seeking to %d in file %s", pos, s->path);
    484491  }
    485492  // reset read status
Note: See TracChangeset for help on using the changeset viewer.