KallDrexx / rust-media-libs

Rust based libraries for misc media functionality
Apache License 2.0
229 stars 58 forks source link

threaded_rtmp_server: signal stream-end to players #34

Closed JonathanMurray closed 1 year ago

JonathanMurray commented 1 year ago

Hi! I was playing around with something based on the threaded_rtmp_server example (which was very helpful!) and noticed that the end of a stream doesn't seem to be signalled to players, causing some issues for me. It looks like the necessary parts are there and it's just a matter of wiring them together (mainly ServerSessionEvent::PublishStreamFinished and ServerSession::finish_playing). It does the trick for me, so I thought I'd upstream it in case it looks sensible to you.


I tested the changes by pushing media from OBS (with the settings Service: Custom..., Server: rtmp://localhost:1935/a, Stream Key: b) and consuming it with ffmpeg -y -hide_banner -loglevel debug -i rtmp://localhost:1935/a/b dud.mp4.

FFmpeg version used: ffmpeg version 4.4.3 Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 14.0.0 (clang-1400.0.29.102)

OBS version used: 27.0.1 (64 bit)

ROBERT-MCDOWELL commented 1 year ago

@KallDrexx is your project https://kalldrexx.github.io/mmids/ will be integrated in crate libs soon? do you think any chance RTMFP protocol could be implemented with the help of web transport? I think your project can be very useful for ruffle, the flash emulator.... cheers

KallDrexx commented 1 year ago

@ROBERT-MCDOWELL - Mind opening an issue to discuss? I'm not totally clear how you mean by "integrated in crate libs soon". I'm also not to sure how mmids would work for ruffle since mmids is a media server.

I don't believe there are any rust servers that support Web Transport yet (which is unfortunate because I would love to implement RUSH and WARP). I'd have to see what the protocol difference between RTMP and RTMFP is to really grok it.

ROBERT-MCDOWELL commented 1 year ago

rtmp is TCP, rtmfp is UDP with p2p and congestion mechanism. https://crates.io/ is the most used libraries for both client and servers. web transport can be used on web browser client application side with WASM as compiler... here is the ruffle contribution page https://github.com/ruffle-rs/ruffle/wiki