Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1464)

Unified Diff: webrtc/examples/objc/AppRTCMobile/ARDSDPUtils.m

Issue 2520933002: iOS AppRTCMobile: Fix SDP video codec reordering for multiple H264 profiles (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/objc/AppRTCMobile/ARDSDPUtils.m
diff --git a/webrtc/examples/objc/AppRTCMobile/ARDSDPUtils.m b/webrtc/examples/objc/AppRTCMobile/ARDSDPUtils.m
index 3a8a578dc68fccf47cab303d315866749a494893..9552936924519e16f38f5ff814e3853b9d6d7c08 100644
--- a/webrtc/examples/objc/AppRTCMobile/ARDSDPUtils.m
+++ b/webrtc/examples/objc/AppRTCMobile/ARDSDPUtils.m
@@ -27,7 +27,9 @@
[NSMutableArray arrayWithArray:
[sdpString componentsSeparatedByString:lineSeparator]];
NSInteger mLineIndex = -1;
- NSString *codecRtpMap = nil;
+ // An array with all payload types with name |codec|. The payload types are
+ // integers in the range 96-127, but they are stored as strings here.
+ NSMutableArray *codecPayloadTypes = [[NSMutableArray alloc] init];
// a=rtpmap:<payload type> <encoding name>/<clock rate>
// [/<encoding parameters>]
NSString *pattern =
@@ -36,8 +38,7 @@
[NSRegularExpression regularExpressionWithPattern:pattern
options:0
error:nil];
- for (NSInteger i = 0; (i < lines.count) && (mLineIndex == -1 || !codecRtpMap);
- ++i) {
+ for (NSInteger i = 0; i < lines.count; ++i) {
NSString *line = lines[i];
if ([line hasPrefix:@"m=video"]) {
mLineIndex = i;
@@ -48,17 +49,16 @@
options:0
range:NSMakeRange(0, line.length)];
if (codecMatches) {
- codecRtpMap =
- [line substringWithRange:[codecMatches rangeAtIndex:1]];
- continue;
+ [codecPayloadTypes
+ addObject:[line substringWithRange:[codecMatches rangeAtIndex:1]]];
}
}
if (mLineIndex == -1) {
daniela-webrtc 2016/11/21 16:23:00 can we extract the check for the "m=video" even be
magjed_webrtc 2016/11/22 14:40:24 Done, I extracted finding the "m=video" line out f
RTCLog(@"No m=video line, so can't prefer %@", codec);
return description;
}
- if (!codecRtpMap) {
- RTCLog(@"No rtpmap for %@", codec);
+ if ([codecPayloadTypes count] == 0) {
+ RTCLog(@"No payload types with name %@", codec);
return description;
}
NSArray *origMLineParts =
@@ -71,9 +71,9 @@
[newMLineParts addObject:origMLineParts[origPartIndex++]];
[newMLineParts addObject:origMLineParts[origPartIndex++]];
[newMLineParts addObject:origMLineParts[origPartIndex++]];
- [newMLineParts addObject:codecRtpMap];
+ [newMLineParts addObjectsFromArray:codecPayloadTypes];
daniela-webrtc 2016/11/21 16:23:00 Perhaps we can extend the usage of methods of NSMu
magjed_webrtc 2016/11/22 14:40:24 Done, I tried my best to make it cleaner.
for (; origPartIndex < origMLineParts.count; ++origPartIndex) {
- if (![codecRtpMap isEqualToString:origMLineParts[origPartIndex]]) {
+ if (![codecPayloadTypes containsObject:origMLineParts[origPartIndex]]) {
[newMLineParts addObject:origMLineParts[origPartIndex]];
}
}

Powered by Google App Engine
This is Rietveld 408576698