Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/bandwidth-estimation-from-disk currentTimestamp not updated correctly #2896

Open
cozzl opened this issue Sep 2, 2024 · 0 comments

Comments

@cozzl
Copy link

cozzl commented Sep 2, 2024

In the examples/bandwidth-estimation-from-disk/main.go file, the currentTimestamp variable is intended to track the current video frame's timestamp to ensure correct playback when switching video quality levels. However, currentTimestamp is not being updated correctly and remains at its initial value.

Update currentTimestamp after each video frame is read and sent. Here is the code snippet:

    // ... 
for ; true; <-ticker.C {
    targetBitrate := estimator.GetTargetBitrate()
    switch {

    // ... 

    default:
        frame, frameHeader, err = ivf.ParseNextFrame() // modify this section
    }

    switch {
    // If we have reached the end of the file, start again
    case errors.Is(err, io.EOF):
        ivf.ResetReader(setReaderFile(qualityLevels[currentQuality].fileName))

    // No error, write the video frame
    case err == nil:
        currentTimestamp = frameHeader.Timestamp // Update currentTimestamp
        if err = videoTrack.WriteSample(media.Sample{Data: frame, Duration: time.Second}); err != nil {
            panic(err)
        }
    // Handle other unknown errors
    default:
        panic(err)
    }
}
@cozzl cozzl changed the title examples/bandwidth-estimation-from-disk currentTimestamp Not Updated Correctly examples/bandwidth-estimation-from-disk currentTimestamp not updated correctly Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant