mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 19:41:00 +00:00
webrtc: janus: rename RoomId to JanusId
Those weird ids are used in multiple places, not only for the room id, so best to have a more generic name. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1480>
This commit is contained in:
parent
550018c917
commit
eabf31e6d0
1 changed files with 15 additions and 13 deletions
|
@ -44,7 +44,9 @@ fn feed_id() -> u32 {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
enum RoomId {
|
/// Ids are either u64 (default) or string in Janus, depending of the
|
||||||
|
/// `string_ids` configuration in the videoroom plugin config file.
|
||||||
|
enum JanusId {
|
||||||
Str(String),
|
Str(String),
|
||||||
Num(u64),
|
Num(u64),
|
||||||
}
|
}
|
||||||
|
@ -77,8 +79,8 @@ struct AttachPluginMsg {
|
||||||
struct RoomRequestBody {
|
struct RoomRequestBody {
|
||||||
request: String,
|
request: String,
|
||||||
ptype: String,
|
ptype: String,
|
||||||
room: RoomId,
|
room: JanusId,
|
||||||
id: RoomId,
|
id: JanusId,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
display: Option<String>,
|
display: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -152,12 +154,12 @@ struct InnerError {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
struct RoomJoined {
|
struct RoomJoined {
|
||||||
room: RoomId,
|
room: JanusId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
struct RoomEvent {
|
struct RoomEvent {
|
||||||
room: Option<RoomId>,
|
room: Option<JanusId>,
|
||||||
error_code: Option<i32>,
|
error_code: Option<i32>,
|
||||||
error: Option<String>,
|
error: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -224,8 +226,8 @@ struct State {
|
||||||
session_id: Option<u64>,
|
session_id: Option<u64>,
|
||||||
handle_id: Option<u64>,
|
handle_id: Option<u64>,
|
||||||
transaction_id: Option<String>,
|
transaction_id: Option<String>,
|
||||||
room_id: Option<RoomId>,
|
room_id: Option<JanusId>,
|
||||||
feed_id: Option<RoomId>,
|
feed_id: Option<JanusId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -543,18 +545,18 @@ impl Signaller {
|
||||||
* API calls.
|
* API calls.
|
||||||
*/
|
*/
|
||||||
if settings.string_ids {
|
if settings.string_ids {
|
||||||
state.room_id = Some(RoomId::Str(settings.room_id.clone().unwrap()));
|
state.room_id = Some(JanusId::Str(settings.room_id.clone().unwrap()));
|
||||||
state.feed_id = Some(RoomId::Str(settings.feed_id.clone()));
|
state.feed_id = Some(JanusId::Str(settings.feed_id.clone()));
|
||||||
} else {
|
} else {
|
||||||
let room_id_str = settings.room_id.as_ref().unwrap();
|
let room_id_str = settings.room_id.as_ref().unwrap();
|
||||||
match room_id_str.parse() {
|
match room_id_str.parse() {
|
||||||
Ok(n) => {
|
Ok(n) => {
|
||||||
state.room_id = Some(RoomId::Num(n));
|
state.room_id = Some(JanusId::Num(n));
|
||||||
state.feed_id = Some(RoomId::Num(settings.feed_id.parse().unwrap()));
|
state.feed_id = Some(JanusId::Num(settings.feed_id.parse().unwrap()));
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
state.room_id = Some(RoomId::Str(room_id_str.clone()));
|
state.room_id = Some(JanusId::Str(room_id_str.clone()));
|
||||||
state.feed_id = Some(RoomId::Str(settings.feed_id.clone()));
|
state.feed_id = Some(JanusId::Str(settings.feed_id.clone()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue