Skip to content

Commit

Permalink
Ignore frames with format changes with variableformat=false
Browse files Browse the repository at this point in the history
This fixes things like dv files with single spurious corrupt/different format frames
  • Loading branch information
myrsloik committed Oct 17, 2024
1 parent 5cc9de9 commit cc2b8b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/audiosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool LWAudioDecoder::DecodeNextFrame(bool SkipOutput) {
int Ret = avcodec_receive_frame(CodecContext, DecodeFrame);
if (Ret == 0) {
return true;
} else if (Ret == AVERROR(EAGAIN)) {
} else if (Ret == AVERROR(EAGAIN) || Ret == AVERROR_INPUT_CHANGED) { // AVERROR_INPUT_CHANGED is only used for two things inside FFmpeg and the other one can't happen, therefore we don't need to care about whether or not variable format is allowed
if (ReadPacket()) {
avcodec_send_packet(CodecContext, Packet);
av_packet_unref(Packet);
Expand Down
2 changes: 1 addition & 1 deletion src/videosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool LWVideoDecoder::DecodeNextFrame(bool SkipOutput) {
}
}
return true;
} else if (Ret == AVERROR(EAGAIN)) {
} else if (Ret == AVERROR(EAGAIN) || Ret == AVERROR_INPUT_CHANGED) { // AVERROR_INPUT_CHANGED is only used for two things inside FFmpeg and the other one can't happen, therefore we don't need to care about whether or not variable format is allowed
if (ReadPacket()) {
avcodec_send_packet(CodecContext, Packet);
av_packet_unref(Packet);
Expand Down

0 comments on commit cc2b8b7

Please sign in to comment.