Skip to content

Commit

Permalink
Fixed infinite loop issue if avcodec_decode_video2 failed to get a fr…
Browse files Browse the repository at this point in the history
…ame for thumbnailing
  • Loading branch information
andygrundman committed Sep 15, 2011
1 parent 0e807f8 commit 84aff76
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ MediaScanImage *video_create_image_from_frame(MediaScanVideo *v, MediaScanResult
// Skip frame if it's not from the video stream
if (!no_keyframe_found && packet.stream_index != codecs->vsid) {
av_free_packet(&packet);
skipped_frames++;
continue;
}

Expand All @@ -141,8 +142,12 @@ MediaScanImage *video_create_image_from_frame(MediaScanVideo *v, MediaScanResult
LOG_ERROR("Error decoding video frame for thumbnail: %s\n", v->path);
goto err;
}
// Try next frame
continue;
if (!no_keyframe_found) {
// Try next frame
av_free_packet(&packet);
skipped_frames++;
continue;
}
}

// use swscale to convert from source format to RGBA in our buffer with no resizing
Expand Down

0 comments on commit 84aff76

Please sign in to comment.