Fix mistake in seeking cleanup

In `ffmpeg_read_video_frame` fix assignment used as truth value.
In `ffmpeg_seek_recover_stream_position` loop while return value is
greater or equal to 0.
This commit is contained in:
Richard Antalik 2022-03-02 22:25:43 +01:00
parent f531dff9b3
commit ecba8c1243
1 changed files with 3 additions and 2 deletions

View File

@ -870,11 +870,12 @@ static void ffmpeg_decode_store_frame_pts(struct anim *anim)
static int ffmpeg_read_video_frame(struct anim *anim, AVPacket *packet)
{
int ret = 0;
while (ret = av_read_frame(anim->pFormatCtx, packet) >= 0) {
while ((ret = av_read_frame(anim->pFormatCtx, packet)) >= 0) {
if (packet->stream_index == anim->videoStream) {
break;
}
}
return ret;
}
@ -1174,7 +1175,7 @@ static int ffmpeg_generic_seek_workaround(struct anim *anim,
static void ffmpeg_seek_recover_stream_position(struct anim *anim)
{
AVPacket *temp_packet = av_packet_alloc();
while (ffmpeg_read_video_frame(anim, temp_packet)) {
while (ffmpeg_read_video_frame(anim, temp_packet) >= 0) {
int64_t current_pts = timestamp_from_pts_or_dts(anim->cur_packet->pts, anim->cur_packet->dts);
int64_t temp_pts = timestamp_from_pts_or_dts(temp_packet->pts, temp_packet->dts);
av_packet_unref(temp_packet);