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

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

Issue 2977213002: Reland of Injectable Obj-C video codecs (Closed)
Patch Set: Add checks to make sure destroy is called 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/RTCVideoCodec.h"
12
13 #include "webrtc/modules/include/module_common_types.h"
14
15 @implementation RTCRtpFragmentationHeader
16
17 @synthesize fragmentationOffset = _fragmentationOffset;
18 @synthesize fragmentationLength = _fragmentationLength;
19 @synthesize fragmentationTimeDiff = _fragmentationTimeDiff;
20 @synthesize fragmentationPlType = _fragmentationPlType;
21
22 - (instancetype)initWithFragmentationHeader:
Chuck 2017/07/21 15:59:48 initWithNativeFrasgmentationHeader
23 (const webrtc::RTPFragmentationHeader *)fragmentationHeader {
24 if (self = [super init]) {
25 if (fragmentationHeader) {
26 int count = fragmentationHeader->fragmentationVectorSize;
27 NSMutableArray *offsets = [NSMutableArray array];
28 NSMutableArray *lengths = [NSMutableArray array];
29 NSMutableArray *timeDiffs = [NSMutableArray array];
30 NSMutableArray *plTypes = [NSMutableArray array];
31 for (int i = 0; i < count; ++i) {
32 [offsets addObject:@(fragmentationHeader->fragmentationOffset[i])];
33 [lengths addObject:@(fragmentationHeader->fragmentationLength[i])];
34 [timeDiffs addObject:@(fragmentationHeader->fragmentationTimeDiff[i])];
35 [plTypes addObject:@(fragmentationHeader->fragmentationPlType[i])];
36 }
37 _fragmentationOffset = [offsets copy];
38 _fragmentationLength = [lengths copy];
39 _fragmentationTimeDiff = [timeDiffs copy];
40 _fragmentationPlType = [plTypes copy];
41 }
42 }
43
44 return self;
45 }
46
47 - (std::unique_ptr<webrtc::RTPFragmentationHeader>)toCpp {
Chuck 2017/07/21 15:59:48 createNativeFragmentationHeader
48 auto fragmentationHeader =
49 std::unique_ptr<webrtc::RTPFragmentationHeader>(new webrtc::RTPFragmentati onHeader);
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