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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCRtpFragmentationHeader.mm

Issue 2989803002: ObjC style fix for injectable video codecs (Closed)
Patch Set: Created 3 years, 4 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "WebRTC/RTCVideoCodec.h" 11 #import "WebRTC/RTCVideoCodec.h"
12 12
13 #include "webrtc/modules/include/module_common_types.h" 13 #include "webrtc/modules/include/module_common_types.h"
14 14
15 @implementation RTCRtpFragmentationHeader 15 @implementation RTCRtpFragmentationHeader
16 16
17 @synthesize fragmentationOffset = _fragmentationOffset; 17 @synthesize fragmentationOffset = _fragmentationOffset;
18 @synthesize fragmentationLength = _fragmentationLength; 18 @synthesize fragmentationLength = _fragmentationLength;
19 @synthesize fragmentationTimeDiff = _fragmentationTimeDiff; 19 @synthesize fragmentationTimeDiff = _fragmentationTimeDiff;
20 @synthesize fragmentationPlType = _fragmentationPlType; 20 @synthesize fragmentationPlType = _fragmentationPlType;
21 21
22 - (instancetype)initWithFragmentationHeader: 22 - (instancetype)initWithNativeFragmentationHeader:
23 (const webrtc::RTPFragmentationHeader *)fragmentationHeader { 23 (const webrtc::RTPFragmentationHeader *)fragmentationHeader {
24 if (self = [super init]) { 24 if (self = [super init]) {
25 if (fragmentationHeader) { 25 if (fragmentationHeader) {
26 int count = fragmentationHeader->fragmentationVectorSize; 26 int count = fragmentationHeader->fragmentationVectorSize;
27 NSMutableArray *offsets = [NSMutableArray array]; 27 NSMutableArray *offsets = [NSMutableArray array];
28 NSMutableArray *lengths = [NSMutableArray array]; 28 NSMutableArray *lengths = [NSMutableArray array];
29 NSMutableArray *timeDiffs = [NSMutableArray array]; 29 NSMutableArray *timeDiffs = [NSMutableArray array];
30 NSMutableArray *plTypes = [NSMutableArray array]; 30 NSMutableArray *plTypes = [NSMutableArray array];
31 for (int i = 0; i < count; ++i) { 31 for (int i = 0; i < count; ++i) {
32 [offsets addObject:@(fragmentationHeader->fragmentationOffset[i])]; 32 [offsets addObject:@(fragmentationHeader->fragmentationOffset[i])];
33 [lengths addObject:@(fragmentationHeader->fragmentationLength[i])]; 33 [lengths addObject:@(fragmentationHeader->fragmentationLength[i])];
34 [timeDiffs addObject:@(fragmentationHeader->fragmentationTimeDiff[i])]; 34 [timeDiffs addObject:@(fragmentationHeader->fragmentationTimeDiff[i])];
35 [plTypes addObject:@(fragmentationHeader->fragmentationPlType[i])]; 35 [plTypes addObject:@(fragmentationHeader->fragmentationPlType[i])];
36 } 36 }
37 _fragmentationOffset = [offsets copy]; 37 _fragmentationOffset = [offsets copy];
38 _fragmentationLength = [lengths copy]; 38 _fragmentationLength = [lengths copy];
39 _fragmentationTimeDiff = [timeDiffs copy]; 39 _fragmentationTimeDiff = [timeDiffs copy];
40 _fragmentationPlType = [plTypes copy]; 40 _fragmentationPlType = [plTypes copy];
41 } 41 }
42 } 42 }
43 43
44 return self; 44 return self;
45 } 45 }
46 46
47 - (std::unique_ptr<webrtc::RTPFragmentationHeader>)toCpp { 47 - (std::unique_ptr<webrtc::RTPFragmentationHeader>)createNativeFragmentationHead er {
48 auto fragmentationHeader = 48 auto fragmentationHeader =
49 std::unique_ptr<webrtc::RTPFragmentationHeader>(new webrtc::RTPFragmentati onHeader); 49 std::unique_ptr<webrtc::RTPFragmentationHeader>(new webrtc::RTPFragmentati onHeader);
50 fragmentationHeader->VerifyAndAllocateFragmentationHeader(_fragmentationOffset .count); 50 fragmentationHeader->VerifyAndAllocateFragmentationHeader(_fragmentationOffset .count);
51 for (NSUInteger i = 0; i < _fragmentationOffset.count; ++i) { 51 for (NSUInteger i = 0; i < _fragmentationOffset.count; ++i) {
52 fragmentationHeader->fragmentationOffset[i] = (size_t)_fragmentationOffset[i ].unsignedIntValue; 52 fragmentationHeader->fragmentationOffset[i] = (size_t)_fragmentationOffset[i ].unsignedIntValue;
53 fragmentationHeader->fragmentationLength[i] = (size_t)_fragmentationLength[i ].unsignedIntValue; 53 fragmentationHeader->fragmentationLength[i] = (size_t)_fragmentationLength[i ].unsignedIntValue;
54 fragmentationHeader->fragmentationTimeDiff[i] = 54 fragmentationHeader->fragmentationTimeDiff[i] =
55 (uint16_t)_fragmentationOffset[i].unsignedIntValue; 55 (uint16_t)_fragmentationOffset[i].unsignedIntValue;
56 fragmentationHeader->fragmentationPlType[i] = (uint8_t)_fragmentationOffset[ i].unsignedIntValue; 56 fragmentationHeader->fragmentationPlType[i] = (uint8_t)_fragmentationOffset[ i].unsignedIntValue;
57 } 57 }
58 58
59 return fragmentationHeader; 59 return fragmentationHeader;
60 } 60 }
61 61
62 @end 62 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698