Skip to content

Commit

Permalink
Remove flushbuffers hack completely
Browse files Browse the repository at this point in the history
  • Loading branch information
myrsloik committed Oct 17, 2016
1 parent fb0274b commit 5116280
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/core/audiosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void FFMS_AudioSource::GetAudio(void *Buf, int64_t Start, int64_t Count) {
PacketNumber = NewPacketNumber;
CurrentSample = -1;
DecodeFrame.reset();
avcodec_flush_buffers(CodecContext);
FlushBuffers(CodecContext);
Seek();
}
}
Expand Down
23 changes: 1 addition & 22 deletions src/core/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,7 @@ void LAVFOpenFile(const char *SourceFile, AVFormatContext *&FormatContext, int T
}

void FlushBuffers(AVCodecContext *CodecContext) {
if (CodecContext->codec->flush)
avcodec_flush_buffers(CodecContext);
else {
// If the codec doesn't have flush(), it might not need it... or it
// might need it and just not implement it as in the case of VC-1, so
// close and reopen the codec
const AVCodec *codec = CodecContext->codec;

// Only flush blacklisted codecs, closing and reopening breaks far too
// many decoders to always do as a fallback!!!

// Further notes: VC1 does have a flush in recent versions so
// maybe just remove all this junk unless more formats are found that
// need it
if (codec->id == FFMS_ID(VC1)) {
avcodec_close(CodecContext);
// Whether or not codec is const varies between versions
if (avcodec_open2(CodecContext, const_cast<AVCodec *>(codec), nullptr) < 0)
throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_CODEC,
"Couldn't re-open codec.");
}
}
avcodec_flush_buffers(CodecContext);
}

int ResizerNameToSWSResizer(const char *ResizerName) {
Expand Down

0 comments on commit 5116280

Please sign in to comment.