feat(airplay): send the configured display name to the receiver - #47
Open
nikhilshastry2003 wants to merge 1 commit into
Open
feat(airplay): send the configured display name to the receiver#47nikhilshastry2003 wants to merge 1 commit into
nikhilshastry2003 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
display_nameinconfig.toml(and--name) only ever reached the sender's own window. Every AirPlay request —GET /info,POST /stream, in both the plain and the authenticated flow — sent the constant"OpenPlay"asX-Apple-Device-Name, which is the name a receiver shows for the sender. So a user who named their machine got "OpenPlay" on the TV regardless.What changes
http_session.rs— theOPENPLAY_DEVICE_NAMEconstant becomespub const DEFAULT_DEVICE_NAME, andnegotiate,get_info,post_stream,post_stream_on,get_info_rawandbuild_stream_requesttake adevice_name: &str. Each runs it through a newheader_safe_device_name()before putting it in the header: control characters (line breaks included) are dropped, whitespace trimmed, and a name with nothing left falls back to the default. A header ends at the first CR/LF, so without that a name from a hand-edited config could cut the request short and have its tail read as further headers. Non-ASCII is kept — Apple's own senders send it.session.rs—AirPlaySession::startgainsdevice_name: &str. Internally the format, session id and name travel in a privateSessionParamsstruct, which keepsrun_sessionandnegotiate_with_authunder clippy's seven-argument limit instead of adding an#[allow].openplay-sender—start_airplay_casttakes aCastSettings { bitrate_kbps, framerate, force_sw_encode, display_name }built fromAppConfiginapp.rs, for the same argument-count reason.run_airplay_pipelinestops takingwidth/heightseparately — they were already in theCaptureConfigit receives. Miracast's entry points are left as they are; they can move to the same struct when they need a fifth value.pair_probeandcontrol_probepassDEFAULT_DEVICE_NAMEexplicitly.docs/configuration.md, the README usage block and the--namehelp text now say the name is sent to AirPlay receivers, not only shown in the window.Tests
Four new unit tests in
http_session.rs:X-Apple-Device-Namein the builtPOST /stream\r\ncannot introduce a second header (the negative assertion fails if the sanitiser is removed)DEFAULT_DEVICE_NAMEVerified
cargo fmt --all -- --checkcleancargo clippy -p openplay-airplay --all-targets --all-features -- -D warningscleancargo test -p openplay-airplay— 46 + 27 passed (was 42 + 27)Not verified locally:
openplay-sender. The machine this was written on has no GStreamer, so the three sender files (app.rs,casting.rs,main.rs) are compiled by CI only. The diff there is small and mechanical, but I want to state the gap rather than imply it was built.Relation to #44
This touches the same
negotiate/negotiate_with_authregion ofsession.rsthat #44 rewrites (the retry-on-status block), so whichever lands second will need a small rebase. Happy to do that here once #44 merges — the overlap is the argument list on two calls, nothing in the logic.