fix(call): enable direct video and shorten portmap probe
This commit is contained in:
@@ -759,7 +759,7 @@ impl CallEngine {
|
|||||||
t_ms = call_t0.elapsed().as_millis(),
|
t_ms = call_t0.elapsed().as_millis(),
|
||||||
"first-join diag: direct P2P — skipping relay handshake (QUIC TLS is the encryption layer)"
|
"first-join diag: direct P2P — skipping relay handshake (QUIC TLS is the encryption layer)"
|
||||||
);
|
);
|
||||||
(None, transport)
|
(Some(wzp_proto::CodecId::H264Baseline), transport)
|
||||||
};
|
};
|
||||||
crate::emit_call_debug(
|
crate::emit_call_debug(
|
||||||
&app,
|
&app,
|
||||||
@@ -1869,8 +1869,9 @@ impl CallEngine {
|
|||||||
));
|
));
|
||||||
|
|
||||||
// Video send task (Android) — mirror of the desktop branch. Only
|
// Video send task (Android) — mirror of the desktop branch. Only
|
||||||
// spawns when the relay handshake negotiated a video codec; on
|
// spawns when a video codec is available. Relay calls negotiate this
|
||||||
// direct P2P video is currently disabled.
|
// in the media handshake; direct P2P uses the common H264 baseline
|
||||||
|
// codec because the relay handshake is intentionally skipped.
|
||||||
let camera_tx = if let Some(vid_codec) = _negotiated_video_codec {
|
let camera_tx = if let Some(vid_codec) = _negotiated_video_codec {
|
||||||
let (tx, mut rx) = tokio::sync::mpsc::channel::<wzp_video::encoder::VideoFrame>(4);
|
let (tx, mut rx) = tokio::sync::mpsc::channel::<wzp_video::encoder::VideoFrame>(4);
|
||||||
let vid_transport = transport.clone();
|
let vid_transport = transport.clone();
|
||||||
@@ -2172,11 +2173,7 @@ impl CallEngine {
|
|||||||
"video:send_disabled",
|
"video:send_disabled",
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"t_ms": call_t0.elapsed().as_millis(),
|
"t_ms": call_t0.elapsed().as_millis(),
|
||||||
"reason": if is_direct_p2p {
|
"reason": "no_video_codec_negotiated",
|
||||||
"direct_p2p_skips_relay_handshake"
|
|
||||||
} else {
|
|
||||||
"no_video_codec_negotiated"
|
|
||||||
},
|
|
||||||
"platform": "android",
|
"platform": "android",
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -2310,7 +2307,7 @@ impl CallEngine {
|
|||||||
(hs.video_codec, transport)
|
(hs.video_codec, transport)
|
||||||
} else {
|
} else {
|
||||||
info!("direct P2P — skipping relay handshake (QUIC TLS is the encryption layer)");
|
info!("direct P2P — skipping relay handshake (QUIC TLS is the encryption layer)");
|
||||||
(None, transport)
|
(Some(wzp_proto::CodecId::H264Baseline), transport)
|
||||||
};
|
};
|
||||||
crate::emit_call_debug(
|
crate::emit_call_debug(
|
||||||
&_app,
|
&_app,
|
||||||
@@ -3050,9 +3047,9 @@ impl CallEngine {
|
|||||||
event_cb.clone(),
|
event_cb.clone(),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Video send task — active only when the handshake negotiated a video codec.
|
// Video send task — active when a video codec is available. Relay calls
|
||||||
// Camera frames arrive via camera_tx; the task encodes and packetizes them.
|
// negotiate this in the media handshake; direct P2P uses the common H264
|
||||||
// Blocker 4 (camera capture) will push frames into this channel.
|
// baseline codec because the relay handshake is intentionally skipped.
|
||||||
let camera_tx = if let Some(vid_codec) = _negotiated_video_codec {
|
let camera_tx = if let Some(vid_codec) = _negotiated_video_codec {
|
||||||
let (tx, mut rx) = tokio::sync::mpsc::channel::<wzp_video::encoder::VideoFrame>(4);
|
let (tx, mut rx) = tokio::sync::mpsc::channel::<wzp_video::encoder::VideoFrame>(4);
|
||||||
let vid_transport = transport.clone();
|
let vid_transport = transport.clone();
|
||||||
@@ -3354,11 +3351,7 @@ impl CallEngine {
|
|||||||
"video:send_disabled",
|
"video:send_disabled",
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"t_ms": call_t0.elapsed().as_millis(),
|
"t_ms": call_t0.elapsed().as_millis(),
|
||||||
"reason": if is_direct_p2p {
|
"reason": "no_video_codec_negotiated",
|
||||||
"direct_p2p_skips_relay_handshake"
|
|
||||||
} else {
|
|
||||||
"no_video_codec_negotiated"
|
|
||||||
},
|
|
||||||
"platform": "desktop",
|
"platform": "desktop",
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2462,8 +2462,13 @@ async fn place_call(
|
|||||||
.map(|la| la.port())
|
.map(|la| la.port())
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
if v4_port > 0 {
|
if v4_port > 0 {
|
||||||
match wzp_client::portmap::acquire_port_mapping(v4_port, None).await {
|
match tokio::time::timeout(
|
||||||
Ok(mapping) => {
|
std::time::Duration::from_millis(750),
|
||||||
|
wzp_client::portmap::acquire_port_mapping(v4_port, None),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(Ok(mapping)) => {
|
||||||
let addr = mapping.external_addr.to_string();
|
let addr = mapping.external_addr.to_string();
|
||||||
tracing::info!(%addr, protocol = ?mapping.protocol, "place_call: port mapping acquired");
|
tracing::info!(%addr, protocol = ?mapping.protocol, "place_call: port mapping acquired");
|
||||||
emit_call_debug(
|
emit_call_debug(
|
||||||
@@ -2475,10 +2480,19 @@ async fn place_call(
|
|||||||
);
|
);
|
||||||
Some(addr)
|
Some(addr)
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Ok(Err(e)) => {
|
||||||
tracing::debug!(error = %e, "place_call: port mapping unavailable (normal on most networks)");
|
tracing::debug!(error = %e, "place_call: port mapping unavailable (normal on most networks)");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
Err(_) => {
|
||||||
|
tracing::debug!("place_call: port mapping quick probe timed out");
|
||||||
|
emit_call_debug(
|
||||||
|
&app,
|
||||||
|
"place_call:portmap_timeout",
|
||||||
|
serde_json::json!({ "timeout_ms": 750 }),
|
||||||
|
);
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -2705,8 +2719,13 @@ async fn answer_call(
|
|||||||
.map(|la| la.port())
|
.map(|la| la.port())
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
if v4_port > 0 {
|
if v4_port > 0 {
|
||||||
match wzp_client::portmap::acquire_port_mapping(v4_port, None).await {
|
match tokio::time::timeout(
|
||||||
Ok(mapping) => {
|
std::time::Duration::from_millis(750),
|
||||||
|
wzp_client::portmap::acquire_port_mapping(v4_port, None),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(Ok(mapping)) => {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
addr = %mapping.external_addr,
|
addr = %mapping.external_addr,
|
||||||
protocol = ?mapping.protocol,
|
protocol = ?mapping.protocol,
|
||||||
@@ -2714,10 +2733,19 @@ async fn answer_call(
|
|||||||
);
|
);
|
||||||
Some(mapping.external_addr.to_string())
|
Some(mapping.external_addr.to_string())
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Ok(Err(e)) => {
|
||||||
tracing::debug!(error = %e, "answer_call: port mapping unavailable");
|
tracing::debug!(error = %e, "answer_call: port mapping unavailable");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
Err(_) => {
|
||||||
|
tracing::debug!("answer_call: port mapping quick probe timed out");
|
||||||
|
emit_call_debug(
|
||||||
|
&app,
|
||||||
|
"answer_call:portmap_timeout",
|
||||||
|
serde_json::json!({ "timeout_ms": 750 }),
|
||||||
|
);
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
Reference in New Issue
Block a user