Skip to content

Commit 406b3ac

Browse files
6.4.18-rc1 (#1563)
- Better fix for audio/video codec issues (aka black video stream)
2 parents d70e9f9 + 380a40b commit 406b3ac

File tree

6 files changed

+48
-39
lines changed

6 files changed

+48
-39
lines changed

Monal/Classes/MLCall.m

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,10 @@ -(void) offerSDP
893893
self.encryptionState = MLCallEncryptionStateClear;
894894

895895
XMPPIQ* sdpIQ = [[XMPPIQ alloc] initWithType:kiqSetType to:self.fullRemoteJid];
896-
[sdpIQ addChildNode:[self sanitizeJingleNode:[[MLXMLNode alloc] initWithElement:@"jingle" andNamespace:@"urn:xmpp:jingle:1" withAttributes:@{
896+
[sdpIQ addChildNode:[[MLXMLNode alloc] initWithElement:@"jingle" andNamespace:@"urn:xmpp:jingle:1" withAttributes:@{
897897
@"action": @"session-initiate",
898898
@"sid": self.jmiid,
899-
} andChildren:children andData:nil]]];
899+
} andChildren:children andData:nil]];
900900
@synchronized(self.candidateQueueLock) {
901901
self.localSDP = sdpIQ;
902902
}
@@ -1592,12 +1592,12 @@ -(void) processIncomingSDP:(NSNotification*) notification
15921592
if([iqNode check:@"{urn:xmpp:jingle:1}jingle<action=session-accept>"])
15931593
{
15941594
type = @"answer";
1595-
rawSDP = [HelperTools xml2sdp:[self sanitizeJingleNode:[iqNode findFirst:@"{urn:xmpp:jingle:1}jingle"]] withInitiator:NO];
1595+
rawSDP = [HelperTools xml2sdp:[iqNode findFirst:@"{urn:xmpp:jingle:1}jingle"] withInitiator:NO];
15961596
}
15971597
else if([iqNode check:@"{urn:xmpp:jingle:1}jingle<action=session-initiate>"])
15981598
{
15991599
type = @"offer";
1600-
rawSDP = [HelperTools xml2sdp:[self sanitizeJingleNode:[iqNode findFirst:@"{urn:xmpp:jingle:1}jingle"]] withInitiator:YES];
1600+
rawSDP = [HelperTools xml2sdp:[iqNode findFirst:@"{urn:xmpp:jingle:1}jingle"] withInitiator:YES];
16011601
}
16021602
}
16031603
//handle session-terminate: fake jmi finish message and handle it
@@ -1711,10 +1711,10 @@ -(void) processIncomingSDP:(NSNotification*) notification
17111711
[self.account send:[[XMPPIQ alloc] initAsResponseTo:iqNode]];
17121712

17131713
XMPPIQ* sdpIQ = [[XMPPIQ alloc] initWithType:kiqSetType to:self.fullRemoteJid];
1714-
[sdpIQ addChildNode:[self sanitizeJingleNode:[[MLXMLNode alloc] initWithElement:@"jingle" andNamespace:@"urn:xmpp:jingle:1" withAttributes:@{
1714+
[sdpIQ addChildNode:[[MLXMLNode alloc] initWithElement:@"jingle" andNamespace:@"urn:xmpp:jingle:1" withAttributes:@{
17151715
@"action": @"session-accept",
17161716
@"sid": self.jmiid,
1717-
} andChildren:children andData:nil]]];
1717+
} andChildren:children andData:nil]];
17181718
[self.account send:sdpIQ];
17191719

17201720
@synchronized(self.candidateQueueLock) {
@@ -1845,17 +1845,4 @@ -(BOOL) decryptFingerprintsInIqNode:(XMPPIQ*) iqNode
18451845
return retval;
18461846
}
18471847

1848-
-(MLXMLNode*) sanitizeJingleNode:(MLXMLNode*) jingleNode
1849-
{
1850-
//modify jingle to only include VP8, VP9 and H264 codecs
1851-
//in particular this means: not having any error correction codecs: these cause black video streams
1852-
NSArray* allowedCodecs = @[@"VP8"];//, @"VP9", @"H264"];
1853-
MLXMLNode* sanitizedNode = [jingleNode copy];
1854-
for(MLXMLNode* videoNode in [sanitizedNode find:@"content/{urn:xmpp:jingle:apps:rtp:1}description<media=video>"])
1855-
for(MLXMLNode* payloadNode in [videoNode find:@"payload-type"])
1856-
if(![allowedCodecs containsObject:[payloadNode findFirst:@"/@name"]])
1857-
[videoNode removeChildNode:payloadNode];
1858-
return sanitizedNode;
1859-
}
1860-
18611848
@end

Monal/Classes/WebRTCClient.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,6 @@ final class WebRTCClient: NSObject {
219219
// let videoTransceiver = self.peerConnection.addTransceiver(of:.video, init:RTCRtpTransceiverInit())!
220220
// videoTransceiver.sender.track = videoTrack
221221

222-
let capabilities = WebRTCClient.factory.rtpSenderCapabilities(forKind: kRTCMediaStreamTrackKindVideo)
223-
let codecs = capabilities.codecs
224-
let preferredCodecs = codecs.filter { $0.name=="VP8" }
225-
do {
226-
try videoTransceiver.setCodecPreferences(preferredCodecs, error: ())
227-
} catch {
228-
DDLogError("Error setting codec preferences: \(String(describing:error))")
229-
}
230-
231222
self.remoteVideoTrack = videoTransceiver.receiver.track as? RTCVideoTrack
232223
}
233224

Monal/Monal-Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>UIDesignRequiresCompatibility</key>
6+
<true/>
57
<key>BGTaskSchedulerPermittedIdentifiers</key>
68
<array>
79
<string>im.monal.process</string>

rust/Cargo.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/sdp-to-jingle/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ edition = "2021"
99
crate-type = ["staticlib", "lib"]
1010

1111
[dependencies]
12+
indexmap = {version = "2.13"}
1213
serde = {version = "1.0"}
1314
serde_derive = {version = "1.0"}
1415
quick-xml = { version = "0.39", features = ["serialize", "overlapped-lists"] }

rust/sdp-to-jingle/src/xep_0167.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use std::{
22
any,
3-
collections::{HashMap, HashSet},
3+
collections::HashSet,
44
net::{IpAddr, Ipv4Addr},
55
};
66

7+
use indexmap::IndexMap;
8+
79
use serde_derive::{Deserialize, Serialize};
810
use webrtc_sdp::{
911
address::ExplicitlyTypedAddress,
@@ -482,9 +484,9 @@ pub struct JingleRtpSessions {
482484
#[serde(rename = "$value", skip_serializing_if = "Vec::is_empty", default)]
483485
item: Vec<JingleRtpSessionsValue>,
484486
#[serde(skip)]
485-
payload_helper: HashMap<u8, JingleRtpSessionsPayloadType>,
487+
payload_helper: IndexMap<u8, JingleRtpSessionsPayloadType>,
486488
#[serde(skip)]
487-
ssrc_helper: HashMap<u32, JingleSsrc>,
489+
ssrc_helper: IndexMap<u32, JingleSsrc>,
488490
}
489491

490492
impl JingleRtpSessions {
@@ -493,8 +495,8 @@ impl JingleRtpSessions {
493495
xmlns: "urn:xmpp:jingle:apps:rtp:1".to_string(),
494496
media: JingleRtpSessionMedia::new_from_sdp(sdp_media),
495497
item: Vec::new(),
496-
payload_helper: HashMap::new(),
497-
ssrc_helper: HashMap::new(),
498+
payload_helper: IndexMap::new(),
499+
ssrc_helper: IndexMap::new(),
498500
}
499501
}
500502

@@ -517,7 +519,7 @@ impl JingleRtpSessions {
517519
let p_t = self
518520
.payload_helper
519521
.entry(id)
520-
.or_insert(JingleRtpSessionsPayloadType::new(id));
522+
.or_insert_with(|| JingleRtpSessionsPayloadType::new(id));
521523
p_t
522524
}
523525

@@ -528,7 +530,7 @@ impl JingleRtpSessions {
528530
}
529531

530532
fn get_ssrc(&mut self, id: u32) -> &mut JingleSsrc {
531-
let ssrc = self.ssrc_helper.entry(id).or_insert(JingleSsrc::new(id));
533+
let ssrc = self.ssrc_helper.entry(id).or_insert_with(|| JingleSsrc::new(id));
532534
ssrc
533535
}
534536

@@ -596,17 +598,20 @@ impl JingleRtpSessions {
596598
jingle.add_extmap_allow_mixed();
597599
}
598600

599-
let mut attribute_map: HashMap<u8, Vec<SdpAttribute>> = HashMap::new();
601+
/*
602+
let mut attribute_map: IndexMap<u8, Vec<SdpAttribute>> = IndexMap::new();
600603
let format_ids = match media.get_formats() {
601604
SdpFormatList::Strings(_) => {
602605
// Ignore data-channel
603606
continue;
604607
}
605608
SdpFormatList::Integers(formats) => formats,
606609
};
610+
println!("SdpFormatList: {:?}", format_ids);
607611
for format in format_ids {
608612
attribute_map.insert(*format as u8, Vec::new());
609613
}
614+
*/
610615

611616
let mut media_transport = JingleTransport::new();
612617
let mut fingerprint = JingleTranportFingerprint::new();
@@ -680,10 +685,10 @@ impl JingleRtpSessions {
680685
}
681686
}
682687
SdpAttribute::RemoteCandidate(_) => {}
683-
SdpAttribute::Rtpmap(rtmap) => {
688+
SdpAttribute::Rtpmap(rtpmap) => {
684689
jingle
685-
.get_payload_type(rtmap.payload_type)
686-
.fill_from_sdp_rtpmap(rtmap);
690+
.get_payload_type(rtpmap.payload_type)
691+
.fill_from_sdp_rtpmap(rtpmap);
687692
}
688693
SdpAttribute::Rtcp(_) => {}
689694
SdpAttribute::Rtcpfb(fb) => {

0 commit comments

Comments
 (0)