Skip to content

Commit

Permalink
Fix division by zero in mp4trackdump.
Browse files Browse the repository at this point in the history
  • Loading branch information
enzo1982 committed Mar 20, 2023
1 parent 663a43d commit 530a867
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions util/mp4trackdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static void DumpTrack ( MP4FileHandle mp4file, MP4TrackId tid )
MP4SampleId sid;
MP4Duration time;
uint32_t timescale;
uint64_t msectime;
uint64_t msectime = 0;

uint64_t sectime, mintime, hrtime;

Expand All @@ -49,9 +49,12 @@ static void DumpTrack ( MP4FileHandle mp4file, MP4TrackId tid )

for ( sid = 1; sid <= numSamples; sid++ ) {
time = MP4GetSampleTime( mp4file, tid, sid );
msectime = time;
msectime *= UINT64_C( 1000 );
msectime /= timescale;
if ( timescale > 0 ) {
msectime = time;
msectime *= UINT64_C( 1000 );
msectime /= timescale;
}

if ( msectime == 0 ) {
hrtime = mintime = sectime = UINT64_C( 0 );
}
Expand Down

0 comments on commit 530a867

Please sign in to comment.