Skip to content

Commit

Permalink
Merge pull request #930 from kxxt/fix/Frame/GetSamplesPerFrame
Browse files Browse the repository at this point in the history
Fix Frame::GetSamplesPerFrame when channels = 0
  • Loading branch information
jonoomph authored Jun 2, 2023
2 parents a204512 + bc73ede commit 919f2aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ void Frame::SetFrameNumber(int64_t new_number)
// Calculate the # of samples per video frame (for a specific frame number and frame rate)
int Frame::GetSamplesPerFrame(int64_t number, Fraction fps, int sample_rate, int channels)
{
// Directly return 0 if there are no channels
// so that we do not need to deal with NaNs later
if (channels == 0) return 0;

// Get the total # of samples for the previous frame, and the current frame (rounded)
double fps_rate = fps.Reciprocal().ToDouble();

Expand Down

0 comments on commit 919f2aa

Please sign in to comment.