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

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

Issue 2966023002: Injectable Obj-C video codecs (Closed)
Patch Set: More granular iOS flag checks in header. Created 3 years, 5 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
(Empty)
1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import <WebRTC/RTCRtpFragmentationHeader.h>
12
13 #include "webrtc/modules/include/module_common_types.h"
14
15 // RTP fragmentation header
16 @implementation RTCRtpFragmentationHeader
17
18 @synthesize fragmentationOffset = _fragmentationOffset;
19 @synthesize fragmentationLength = _fragmentationLength;
20 @synthesize fragmentationTimeDiff = _fragmentationTimeDiff;
21 @synthesize fragmentationPlType = _fragmentationPlType;
22
23 - (instancetype)initWithFragmentationHeader:
24 (const webrtc::RTPFragmentationHeader *__nullable)fragmentationHeader {
25 if (self = [super init]) {
26 if (fragmentationHeader) {
27 int count = fragmentationHeader->fragmentationVectorSize;
28 NSMutableArray *offsets = [NSMutableArray array];
29 NSMutableArray *lengths = [NSMutableArray array];
30 NSMutableArray *timeDiffs = [NSMutableArray array];
31 NSMutableArray *plTypes = [NSMutableArray array];
32 for (int i = 0; i < count; ++i) {
33 [offsets addObject:@(fragmentationHeader->fragmentationOffset[i])];
34 [lengths addObject:@(fragmentationHeader->fragmentationLength[i])];
35 [timeDiffs addObject:@(fragmentationHeader->fragmentationTimeDiff[i])];
36 [plTypes addObject:@(fragmentationHeader->fragmentationPlType[i])];
37 }
38 _fragmentationOffset = [offsets copy];
39 _fragmentationLength = [lengths copy];
40 _fragmentationTimeDiff = [timeDiffs copy];
41 _fragmentationPlType = [plTypes copy];
42 }
43 }
44
45 return self;
46 }
47
48 - (webrtc::RTPFragmentationHeader *)toCpp {
49 webrtc::RTPFragmentationHeader *fragmentationHeader = new webrtc::RTPFragmenta tionHeader;
50 fragmentationHeader->VerifyAndAllocateFragmentationHeader(_fragmentationOffset .count);
51 for (NSUInteger i = 0; i < _fragmentationOffset.count; ++i) {
52 fragmentationHeader->fragmentationOffset[i] = (size_t)_fragmentationOffset[i ].unsignedIntValue;
53 fragmentationHeader->fragmentationLength[i] = (size_t)_fragmentationLength[i ].unsignedIntValue;
54 fragmentationHeader->fragmentationTimeDiff[i] =
55 (uint16_t)_fragmentationOffset[i].unsignedIntValue;
56 fragmentationHeader->fragmentationPlType[i] = (uint8_t)_fragmentationOffset[ i].unsignedIntValue;
57 }
58
59 return fragmentationHeader;
60 }
61
62 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698