Delete RTPFragmentationHeader as no longer used
Bug: webrtc:6471 Change-Id: I714ceda3cd84606deda6a47696a65d43f9ab4430 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183041 Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32031}
This commit is contained in:
parent
c03a187391
commit
c60774bed0
@ -34,17 +34,12 @@ rtc_source_set("module_api_public") {
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
rtc_library("module_api") {
|
||||
rtc_source_set("module_api") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"include/module.h",
|
||||
"include/module_common_types.cc",
|
||||
"include/module_common_types.h",
|
||||
]
|
||||
deps = [
|
||||
"../rtc_base:safe_conversions",
|
||||
"../rtc_base/system:rtc_export",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("module_fec_api") {
|
||||
|
||||
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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.
|
||||
*/
|
||||
|
||||
#include "modules/include/module_common_types.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
RTPFragmentationHeader::RTPFragmentationHeader()
|
||||
: fragmentationVectorSize(0),
|
||||
fragmentationOffset(nullptr),
|
||||
fragmentationLength(nullptr) {}
|
||||
|
||||
RTPFragmentationHeader::RTPFragmentationHeader(RTPFragmentationHeader&& other)
|
||||
: RTPFragmentationHeader() {
|
||||
swap(*this, other);
|
||||
}
|
||||
|
||||
RTPFragmentationHeader& RTPFragmentationHeader::operator=(
|
||||
RTPFragmentationHeader&& other) {
|
||||
swap(*this, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
RTPFragmentationHeader::~RTPFragmentationHeader() {
|
||||
delete[] fragmentationOffset;
|
||||
delete[] fragmentationLength;
|
||||
}
|
||||
|
||||
void swap(RTPFragmentationHeader& a, RTPFragmentationHeader& b) {
|
||||
using std::swap;
|
||||
swap(a.fragmentationVectorSize, b.fragmentationVectorSize);
|
||||
swap(a.fragmentationOffset, b.fragmentationOffset);
|
||||
swap(a.fragmentationLength, b.fragmentationLength);
|
||||
}
|
||||
|
||||
void RTPFragmentationHeader::CopyFrom(const RTPFragmentationHeader& src) {
|
||||
if (this == &src) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (src.fragmentationVectorSize != fragmentationVectorSize) {
|
||||
// new size of vectors
|
||||
|
||||
// delete old
|
||||
delete[] fragmentationOffset;
|
||||
fragmentationOffset = nullptr;
|
||||
delete[] fragmentationLength;
|
||||
fragmentationLength = nullptr;
|
||||
|
||||
if (src.fragmentationVectorSize > 0) {
|
||||
// allocate new
|
||||
if (src.fragmentationOffset) {
|
||||
fragmentationOffset = new size_t[src.fragmentationVectorSize];
|
||||
}
|
||||
if (src.fragmentationLength) {
|
||||
fragmentationLength = new size_t[src.fragmentationVectorSize];
|
||||
}
|
||||
}
|
||||
// set new size
|
||||
fragmentationVectorSize = src.fragmentationVectorSize;
|
||||
}
|
||||
|
||||
if (src.fragmentationVectorSize > 0) {
|
||||
// copy values
|
||||
if (src.fragmentationOffset) {
|
||||
memcpy(fragmentationOffset, src.fragmentationOffset,
|
||||
src.fragmentationVectorSize * sizeof(size_t));
|
||||
}
|
||||
if (src.fragmentationLength) {
|
||||
memcpy(fragmentationLength, src.fragmentationLength,
|
||||
src.fragmentationVectorSize * sizeof(size_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RTPFragmentationHeader::Resize(size_t size) {
|
||||
const uint16_t size16 = rtc::dchecked_cast<uint16_t>(size);
|
||||
if (fragmentationVectorSize < size16) {
|
||||
uint16_t old_vector_size = fragmentationVectorSize;
|
||||
size_t* old_offsets = fragmentationOffset;
|
||||
fragmentationOffset = new size_t[size16];
|
||||
memset(fragmentationOffset + old_vector_size, 0,
|
||||
sizeof(size_t) * (size16 - old_vector_size));
|
||||
size_t* old_lengths = fragmentationLength;
|
||||
fragmentationLength = new size_t[size16];
|
||||
memset(fragmentationLength + old_vector_size, 0,
|
||||
sizeof(size_t) * (size16 - old_vector_size));
|
||||
|
||||
// copy old values
|
||||
if (old_vector_size > 0) {
|
||||
if (old_offsets != nullptr) {
|
||||
memcpy(fragmentationOffset, old_offsets,
|
||||
sizeof(size_t) * old_vector_size);
|
||||
delete[] old_offsets;
|
||||
}
|
||||
if (old_lengths != nullptr) {
|
||||
memcpy(fragmentationLength, old_lengths,
|
||||
sizeof(size_t) * old_vector_size);
|
||||
delete[] old_lengths;
|
||||
}
|
||||
}
|
||||
fragmentationVectorSize = size16;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
@ -11,44 +11,12 @@
|
||||
#ifndef MODULES_INCLUDE_MODULE_COMMON_TYPES_H_
|
||||
#define MODULES_INCLUDE_MODULE_COMMON_TYPES_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class RTC_EXPORT RTPFragmentationHeader {
|
||||
public:
|
||||
RTPFragmentationHeader();
|
||||
RTPFragmentationHeader(const RTPFragmentationHeader&) = delete;
|
||||
RTPFragmentationHeader(RTPFragmentationHeader&& other);
|
||||
RTPFragmentationHeader& operator=(const RTPFragmentationHeader& other) =
|
||||
delete;
|
||||
RTPFragmentationHeader& operator=(RTPFragmentationHeader&& other);
|
||||
~RTPFragmentationHeader();
|
||||
|
||||
friend void swap(RTPFragmentationHeader& a, RTPFragmentationHeader& b);
|
||||
|
||||
void CopyFrom(const RTPFragmentationHeader& src);
|
||||
void VerifyAndAllocateFragmentationHeader(size_t size) { Resize(size); }
|
||||
|
||||
void Resize(size_t size);
|
||||
size_t Size() const { return fragmentationVectorSize; }
|
||||
|
||||
size_t Offset(size_t index) const { return fragmentationOffset[index]; }
|
||||
size_t Length(size_t index) const { return fragmentationLength[index]; }
|
||||
|
||||
// TODO(danilchap): Move all members to private section,
|
||||
// simplify by replacing raw arrays with single std::vector<Fragment>
|
||||
uint16_t fragmentationVectorSize; // Number of fragmentations
|
||||
size_t* fragmentationOffset; // Offset of pointer to data for each
|
||||
// fragmentation
|
||||
size_t* fragmentationLength; // Data size for each fragmentation
|
||||
};
|
||||
|
||||
// Interface used by the CallStats class to distribute call statistics.
|
||||
// Callbacks will be triggered as soon as the class has been registered to a
|
||||
// CallStats object using RegisterStatsObserver.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user