Skip to content

Commit

Permalink
fixed #2574
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Aug 31, 2023
1 parent 112767e commit b1042c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/media_tools/avilib.c
Expand Up @@ -2941,15 +2941,14 @@ int AVI_read_frame(avi_t *AVI, u8 *vidbuf, int *keyframe)
}

gf_fseek(AVI->fdes, AVI->video_index[AVI->video_pos].pos, SEEK_SET);
AVI->video_pos++;

if (avi_read(AVI->fdes,vidbuf,n) != (u32) n)
{
AVI_errno = AVI_ERR_READ;
return -1;
}

AVI->video_pos++;

return n;
}

Expand Down Expand Up @@ -3067,6 +3066,7 @@ int AVI_read_audio(avi_t *AVI, u8 *audbuf, int bytes, int *continuous)
todo = left;
pos = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].pos + AVI->track[AVI->aptr].audio_posb;
gf_fseek(AVI->fdes, pos, SEEK_SET);
AVI->track[AVI->aptr].audio_posb += todo;
if ( (ret = avi_read(AVI->fdes,audbuf+nr,todo)) != todo)
{
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[avilib] XXX pos = %"LLD", ret = %"LLD", todo = %ld\n", pos, ret, todo));
Expand All @@ -3075,7 +3075,6 @@ int AVI_read_audio(avi_t *AVI, u8 *audbuf, int bytes, int *continuous)
}
bytes -= todo;
nr += todo;
AVI->track[AVI->aptr].audio_posb += todo;
}

return nr;
Expand Down

0 comments on commit b1042c3

Please sign in to comment.