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

write_sample Does not return when client disconnects #512

Open
Random12Guy opened this issue Nov 11, 2023 · 0 comments
Open

write_sample Does not return when client disconnects #512

Random12Guy opened this issue Nov 11, 2023 · 0 comments

Comments

@Random12Guy
Copy link

To reproduce

  1. Run the play from disk example.
  2. Open the web browser and view the video
  3. Close the browser early

The loop will carry on, so if you're streaming live video, it will never exit even if the client has closed the window.

loop {
        let nal = match h264.next_nal() {
                            Ok(nal) => nal,
                            Err(err) => {
                                println!("All video frames parsed and sent: {err}");
                                break;
                            }
        };
        video_track
        .write_sample(&Sample {
                    data: nal.data.freeze(),
                    duration: Duration::from_secs(1),
                     ..Default::default()
          })
         .await.unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant