Remove usage of webrtc::RTPFragmentationHeader from objc wrappers

Bug: webrtc:6471
Change-Id: Ibe4ce280a9f1aea53016f131d1d235337fe71a4f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182502
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32022}
This commit is contained in:
Danil Chapovalov
2020-08-25 15:49:53 +02:00
committed by Commit Bot
parent c2302e8e2e
commit 090049c546
7 changed files with 13 additions and 163 deletions

View File

@ -1,27 +0,0 @@
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#import "base/RTCRtpFragmentationHeader.h"
#include "modules/include/module_common_types.h"
NS_ASSUME_NONNULL_BEGIN
/* Interfaces for converting to/from internal C++ formats. */
@interface RTC_OBJC_TYPE (RTCRtpFragmentationHeader)
(Private)
- (instancetype)initWithNativeFragmentationHeader
: (const webrtc::RTPFragmentationHeader *__nullable)fragmentationHeader;
- (std::unique_ptr<webrtc::RTPFragmentationHeader>)createNativeFragmentationHeader;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,55 +0,0 @@
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#import "RTCRtpFragmentationHeader+Private.h"
#include "modules/include/module_common_types.h"
@implementation RTC_OBJC_TYPE (RTCRtpFragmentationHeader)
(Private)
- (instancetype)initWithNativeFragmentationHeader
: (const webrtc::RTPFragmentationHeader *)fragmentationHeader {
if (self = [super init]) {
if (fragmentationHeader) {
int count = fragmentationHeader->fragmentationVectorSize;
NSMutableArray *offsets = [NSMutableArray array];
NSMutableArray *lengths = [NSMutableArray array];
NSMutableArray *timeDiffs = [NSMutableArray array];
NSMutableArray *plTypes = [NSMutableArray array];
for (int i = 0; i < count; ++i) {
[offsets addObject:@(fragmentationHeader->fragmentationOffset[i])];
[lengths addObject:@(fragmentationHeader->fragmentationLength[i])];
[timeDiffs addObject:@(0)];
[plTypes addObject:@(0)];
}
self.fragmentationOffset = [offsets copy];
self.fragmentationLength = [lengths copy];
self.fragmentationTimeDiff = [timeDiffs copy];
self.fragmentationPlType = [plTypes copy];
}
}
return self;
}
- (std::unique_ptr<webrtc::RTPFragmentationHeader>)createNativeFragmentationHeader {
auto fragmentationHeader =
std::unique_ptr<webrtc::RTPFragmentationHeader>(new webrtc::RTPFragmentationHeader);
fragmentationHeader->VerifyAndAllocateFragmentationHeader(self.fragmentationOffset.count);
for (NSUInteger i = 0; i < self.fragmentationOffset.count; ++i) {
fragmentationHeader->fragmentationOffset[i] = (size_t)self.fragmentationOffset[i].unsignedIntValue;
fragmentationHeader->fragmentationLength[i] = (size_t)self.fragmentationLength[i].unsignedIntValue;
}
return fragmentationHeader;
}
@end