Give the stream API core-owned types
Command and Event no longer carry voelin-stream's types. voelin-core owns StreamInfo, ViewerInfo, StreamSetup, StreamKind, ViewerState, EndReason and LeaveReason (stream_types.rs) with u16 client ids, a viewer's SRTP profile as its name and its codec as voelin_media::Codec; stream.rs converts at the boundary. Command::SetSrtpProfiles takes profile names, which the stream task parses. EncodedFrame, LayerSpec, LayerId and LayerSet move into voelin-media (stream::EncodedFrame, layer); voelin-stream depends on it and re-exports them, so the engine, the stream sessions and voelinctl share one type. The crate is now a plain dependency of voelin-core (feature media keeps the module and WHIP), and its str0m feature is gone with str0m always there. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b0f95a384f
commit
da372dfe10
28 files changed
+798
-342
No files matched your search
@@ -16,7 +16,6 @@ use tokio::time::Instant;
|
||||
|
||||
use tokio::sync::{broadcast, mpsc, watch};
|
||||
use tracing::{debug, info, warn};
|
||||
use tsclientlib::ClientId;
|
||||
use voelin_audio::{AudioSettings, EncodedVoice, TalkerId};
|
||||
use voelin_gateway_proto::{ErrorCode, HistoryEntry, StreamEntry, StreamSpec, feature};
|
||||
use voelin_model::{ChatMessage, ChatTarget, GroupInfo, Presence, ServerDetails, badges};
|
||||
@@ -38,8 +37,8 @@ use crate::settings::{
|
||||
PRIVACY_PRIVATE_MESSAGES, SharedSettings,
|
||||
};
|
||||
use crate::stream::{
|
||||
LayerSpec, OwnStreamEvent, PeerConfig, SrtpProfile, StreamFrame, StreamHandle, StreamInfo,
|
||||
StreamInput, StreamKind, kind_name, parse_kind,
|
||||
LayerSpec, OwnStreamEvent, PeerConfig, StreamFrame, StreamHandle, StreamInfo, StreamInput,
|
||||
StreamKind, kind_name, parse_kind, parse_srtp_profiles,
|
||||
};
|
||||
use crate::voice::{self, Remote, VoiceCmd, VoiceEvent, VoiceLink};
|
||||
use crate::web;
|
||||
@@ -325,7 +324,7 @@ struct Session {
|
||||
stream_layers: Vec<LayerSpec>,
|
||||
/// The SRTP profile setting (`Command::SetSrtpProfiles`), over the voice
|
||||
/// options' `stream_peer`.
|
||||
srtp_profiles: Option<Vec<SrtpProfile>>,
|
||||
srtp_profiles: Option<Vec<String>>,
|
||||
frames: broadcast::Sender<StreamFrame>,
|
||||
/// Channel and `client_is_streaming` of the voice presence, as last told
|
||||
/// to the streams.
|
||||
@@ -519,7 +518,7 @@ impl Session {
|
||||
self.nickname = options.nickname.clone();
|
||||
self.stream_peer = options.stream_peer.clone();
|
||||
if let Some(profiles) = &self.srtp_profiles {
|
||||
self.stream_peer.srtp_profiles = profiles.clone();
|
||||
self.stream_peer.srtp_profiles = parse_srtp_profiles(profiles);
|
||||
}
|
||||
self.known_server(format!("voice:{}", options.address));
|
||||
let (cmd_tx, cmd_rx) = mpsc::unbounded_channel();
|
||||
@@ -742,7 +741,7 @@ impl Session {
|
||||
}
|
||||
}
|
||||
Command::SetSrtpProfiles(profiles) => {
|
||||
self.stream_peer.srtp_profiles = profiles.clone();
|
||||
self.stream_peer.srtp_profiles = parse_srtp_profiles(&profiles);
|
||||
self.srtp_profiles = Some(profiles.clone());
|
||||
if let Some(s) = &self.streams {
|
||||
s.send(StreamInput::SrtpProfiles(profiles));
|
||||
@@ -1717,7 +1716,7 @@ impl Session {
|
||||
.filter_map(|e| {
|
||||
Some(StreamInfo {
|
||||
id: e.stream_id.clone()?,
|
||||
streamer: ClientId(e.client_id?),
|
||||
streamer: e.client_id?,
|
||||
name: e.title.clone(),
|
||||
kind: parse_kind(&e.kind),
|
||||
// Not in the directory; the stream's offer tells.
|
||||
|
||||
Reference in new issue
Block a user