From fd26ef732fe146d1f7f07706994070b2f8ff6667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Fri, 17 May 2019 10:42:42 +0200 Subject: [PATCH] Delete unused RTPFragmentationHeader members MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deleted fragmentationTimeDiff and fragmentationPlType. Unused since cl https://webrtc-review.googlesource.com/c/src/+/134212. Bug: webrtc:6471 Change-Id: I36b45be6f6babeda5a5f172c1f1a3876bb752e7f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134308 Commit-Queue: Niels Moller Reviewed-by: Danil Chapovalov Reviewed-by: Oskar Sundbom Reviewed-by: Kári Helgason Reviewed-by: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#27972} --- call/rtp_payload_params.h | 1 - modules/include/module_common_types.cc | 46 +------------------ modules/include/module_common_types.h | 7 +-- modules/video_coding/codecs/vp9/vp9_impl.cc | 2 - .../include/video_codec_interface.h | 2 - sdk/android/src/jni/android_media_encoder.cc | 4 -- sdk/android/src/jni/video_encoder_wrapper.cc | 4 -- .../RTCRtpFragmentationHeader+Private.mm | 7 +-- .../components/video_codec/nalu_rewriter.cc | 2 - sdk/objc/unittests/nalu_rewriter_xctest.mm | 12 ----- 10 files changed, 4 insertions(+), 83 deletions(-) diff --git a/call/rtp_payload_params.h b/call/rtp_payload_params.h index 605e294e08..3cbbb1ba69 100644 --- a/call/rtp_payload_params.h +++ b/call/rtp_payload_params.h @@ -22,7 +22,6 @@ namespace webrtc { -class RTPFragmentationHeader; class RtpRtcp; // State for setting picture id and tl0 pic idx, for VP8 and VP9 diff --git a/modules/include/module_common_types.cc b/modules/include/module_common_types.cc index 80eba2e305..b785e466b6 100644 --- a/modules/include/module_common_types.cc +++ b/modules/include/module_common_types.cc @@ -21,9 +21,7 @@ namespace webrtc { RTPFragmentationHeader::RTPFragmentationHeader() : fragmentationVectorSize(0), fragmentationOffset(nullptr), - fragmentationLength(nullptr), - fragmentationTimeDiff(nullptr), - fragmentationPlType(nullptr) {} + fragmentationLength(nullptr) {} RTPFragmentationHeader::RTPFragmentationHeader(RTPFragmentationHeader&& other) : RTPFragmentationHeader() { @@ -39,8 +37,6 @@ RTPFragmentationHeader& RTPFragmentationHeader::operator=( RTPFragmentationHeader::~RTPFragmentationHeader() { delete[] fragmentationOffset; delete[] fragmentationLength; - delete[] fragmentationTimeDiff; - delete[] fragmentationPlType; } void swap(RTPFragmentationHeader& a, RTPFragmentationHeader& b) { @@ -48,8 +44,6 @@ void swap(RTPFragmentationHeader& a, RTPFragmentationHeader& b) { swap(a.fragmentationVectorSize, b.fragmentationVectorSize); swap(a.fragmentationOffset, b.fragmentationOffset); swap(a.fragmentationLength, b.fragmentationLength); - swap(a.fragmentationTimeDiff, b.fragmentationTimeDiff); - swap(a.fragmentationPlType, b.fragmentationPlType); } void RTPFragmentationHeader::CopyFrom(const RTPFragmentationHeader& src) { @@ -65,10 +59,6 @@ void RTPFragmentationHeader::CopyFrom(const RTPFragmentationHeader& src) { fragmentationOffset = nullptr; delete[] fragmentationLength; fragmentationLength = nullptr; - delete[] fragmentationTimeDiff; - fragmentationTimeDiff = nullptr; - delete[] fragmentationPlType; - fragmentationPlType = nullptr; if (src.fragmentationVectorSize > 0) { // allocate new @@ -78,12 +68,6 @@ void RTPFragmentationHeader::CopyFrom(const RTPFragmentationHeader& src) { if (src.fragmentationLength) { fragmentationLength = new size_t[src.fragmentationVectorSize]; } - if (src.fragmentationTimeDiff) { - fragmentationTimeDiff = new uint16_t[src.fragmentationVectorSize]; - } - if (src.fragmentationPlType) { - fragmentationPlType = new uint8_t[src.fragmentationVectorSize]; - } } // set new size fragmentationVectorSize = src.fragmentationVectorSize; @@ -99,14 +83,6 @@ void RTPFragmentationHeader::CopyFrom(const RTPFragmentationHeader& src) { memcpy(fragmentationLength, src.fragmentationLength, src.fragmentationVectorSize * sizeof(size_t)); } - if (src.fragmentationTimeDiff) { - memcpy(fragmentationTimeDiff, src.fragmentationTimeDiff, - src.fragmentationVectorSize * sizeof(uint16_t)); - } - if (src.fragmentationPlType) { - memcpy(fragmentationPlType, src.fragmentationPlType, - src.fragmentationVectorSize * sizeof(uint8_t)); - } } } @@ -133,26 +109,6 @@ void RTPFragmentationHeader::Resize(size_t size) { memcpy(fragmentationLength, oldLengths, sizeof(size_t) * oldVectorSize); delete[] oldLengths; } - // time diff - { - uint16_t* oldTimeDiffs = fragmentationTimeDiff; - fragmentationTimeDiff = new uint16_t[size16]; - memset(fragmentationTimeDiff + oldVectorSize, 0, - sizeof(uint16_t) * (size16 - oldVectorSize)); - memcpy(fragmentationTimeDiff, oldTimeDiffs, - sizeof(uint16_t) * oldVectorSize); - delete[] oldTimeDiffs; - } - // payload type - { - uint8_t* oldTimePlTypes = fragmentationPlType; - fragmentationPlType = new uint8_t[size16]; - memset(fragmentationPlType + oldVectorSize, 0, - sizeof(uint8_t) * (size16 - oldVectorSize)); - memcpy(fragmentationPlType, oldTimePlTypes, - sizeof(uint8_t) * oldVectorSize); - delete[] oldTimePlTypes; - } fragmentationVectorSize = size16; } } diff --git a/modules/include/module_common_types.h b/modules/include/module_common_types.h index 10a3e0556e..5226509d63 100644 --- a/modules/include/module_common_types.h +++ b/modules/include/module_common_types.h @@ -44,18 +44,13 @@ class RTC_EXPORT RTPFragmentationHeader { size_t Offset(size_t index) const { return fragmentationOffset[index]; } size_t Length(size_t index) const { return fragmentationLength[index]; } - uint16_t TimeDiff(size_t index) const { return fragmentationTimeDiff[index]; } - int PayloadType(size_t index) const { return fragmentationPlType[index]; } // TODO(danilchap): Move all members to private section, - // simplify by replacing 4 raw arrays with single std::vector + // simplify by replacing raw arrays with single std::vector 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 - uint16_t* fragmentationTimeDiff; // Timestamp difference relative "now" for - // each fragmentation - uint8_t* fragmentationPlType; // Payload type of each fragmentation }; // Interface used by the CallStats class to distribute call statistics. diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc index 45dacfd1a8..18e146b037 100644 --- a/modules/video_coding/codecs/vp9/vp9_impl.cc +++ b/modules/video_coding/codecs/vp9/vp9_impl.cc @@ -1452,8 +1452,6 @@ void VP9EncoderImpl::DeliverBufferedFrame(bool end_of_picture) { frag_info.VerifyAndAllocateFragmentationHeader(1); frag_info.fragmentationOffset[part_idx] = 0; frag_info.fragmentationLength[part_idx] = encoded_image_.size(); - frag_info.fragmentationPlType[part_idx] = 0; - frag_info.fragmentationTimeDiff[part_idx] = 0; encoded_complete_callback_->OnEncodedImage(encoded_image_, &codec_specific_, &frag_info); diff --git a/modules/video_coding/include/video_codec_interface.h b/modules/video_coding/include/video_codec_interface.h index e0377eda92..4aa13ac964 100644 --- a/modules/video_coding/include/video_codec_interface.h +++ b/modules/video_coding/include/video_codec_interface.h @@ -24,8 +24,6 @@ namespace webrtc { -class RTPFragmentationHeader; // forward declaration - // Note: If any pointers are added to this struct, it must be fitted // with a copy-constructor. See below. // Hack alert - the code assumes that thisstruct is memset when constructed. diff --git a/sdk/android/src/jni/android_media_encoder.cc b/sdk/android/src/jni/android_media_encoder.cc index 863b4b2cbb..4bca01fc7e 100644 --- a/sdk/android/src/jni/android_media_encoder.cc +++ b/sdk/android/src/jni/android_media_encoder.cc @@ -1044,8 +1044,6 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) { header.VerifyAndAllocateFragmentationHeader(1); header.fragmentationOffset[0] = 0; header.fragmentationLength[0] = image->size(); - header.fragmentationPlType[0] = 0; - header.fragmentationTimeDiff[0] = 0; if (codec_type == kVideoCodecVP8) { int qp; if (vp8::GetQp(payload, payload_size, &qp)) { @@ -1081,8 +1079,6 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) { for (size_t i = 0; i < nalu_idxs.size(); i++) { header.fragmentationOffset[i] = nalu_idxs[i].payload_start_offset; header.fragmentationLength[i] = nalu_idxs[i].payload_size; - header.fragmentationPlType[i] = 0; - header.fragmentationTimeDiff[i] = 0; } } diff --git a/sdk/android/src/jni/video_encoder_wrapper.cc b/sdk/android/src/jni/video_encoder_wrapper.cc index 6238e94d49..aac4c27a8b 100644 --- a/sdk/android/src/jni/video_encoder_wrapper.cc +++ b/sdk/android/src/jni/video_encoder_wrapper.cc @@ -334,16 +334,12 @@ RTPFragmentationHeader VideoEncoderWrapper::ParseFragmentationHeader( for (size_t i = 0; i < nalu_idxs.size(); i++) { header.fragmentationOffset[i] = nalu_idxs[i].payload_start_offset; header.fragmentationLength[i] = nalu_idxs[i].payload_size; - header.fragmentationPlType[i] = 0; - header.fragmentationTimeDiff[i] = 0; } } else { // Generate a header describing a single fragment. header.VerifyAndAllocateFragmentationHeader(1); header.fragmentationOffset[0] = 0; header.fragmentationLength[0] = buffer.size(); - header.fragmentationPlType[0] = 0; - header.fragmentationTimeDiff[0] = 0; } return header; } diff --git a/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm b/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm index e2f4b1012d..3a4415a342 100644 --- a/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm +++ b/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm @@ -26,8 +26,8 @@ for (int i = 0; i < count; ++i) { [offsets addObject:@(fragmentationHeader->fragmentationOffset[i])]; [lengths addObject:@(fragmentationHeader->fragmentationLength[i])]; - [timeDiffs addObject:@(fragmentationHeader->fragmentationTimeDiff[i])]; - [plTypes addObject:@(fragmentationHeader->fragmentationPlType[i])]; + [timeDiffs addObject:@(0)]; + [plTypes addObject:@(0)]; } self.fragmentationOffset = [offsets copy]; self.fragmentationLength = [lengths copy]; @@ -46,9 +46,6 @@ 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; - fragmentationHeader->fragmentationTimeDiff[i] = - (uint16_t)self.fragmentationOffset[i].unsignedIntValue; - fragmentationHeader->fragmentationPlType[i] = (uint8_t)self.fragmentationOffset[i].unsignedIntValue; } return fragmentationHeader; diff --git a/sdk/objc/components/video_codec/nalu_rewriter.cc b/sdk/objc/components/video_codec/nalu_rewriter.cc index 55ed1c2b4c..dc258d6064 100644 --- a/sdk/objc/components/video_codec/nalu_rewriter.cc +++ b/sdk/objc/components/video_codec/nalu_rewriter.cc @@ -149,8 +149,6 @@ bool H264CMSampleBufferToAnnexBBuffer( for (size_t i = 0; i < frag_offsets.size(); ++i) { header->fragmentationOffset[i] = frag_offsets[i]; header->fragmentationLength[i] = frag_lengths[i]; - header->fragmentationPlType[i] = 0; - header->fragmentationTimeDiff[i] = 0; } *out_header = std::move(header); CFRelease(contiguous_buffer); diff --git a/sdk/objc/unittests/nalu_rewriter_xctest.mm b/sdk/objc/unittests/nalu_rewriter_xctest.mm index 4b049901c5..490d228573 100644 --- a/sdk/objc/unittests/nalu_rewriter_xctest.mm +++ b/sdk/objc/unittests/nalu_rewriter_xctest.mm @@ -300,13 +300,9 @@ static const uint8_t SPS_PPS_BUFFER[] = { XCTAssertEqual(4, (int)out_header->Offset(0)); XCTAssertEqual(4, (int)out_header->Length(0)); - XCTAssertEqual(0, (int)out_header->TimeDiff(0)); - XCTAssertEqual(0, (int)out_header->PayloadType(0)); XCTAssertEqual(12, (int)out_header->Offset(1)); XCTAssertEqual(2, (int)out_header->Length(1)); - XCTAssertEqual(0, (int)out_header->TimeDiff(1)); - XCTAssertEqual(0, (int)out_header->PayloadType(1)); } - (void)testH264CMSampleBufferToAnnexBBufferWithKeyframe { @@ -352,23 +348,15 @@ static const uint8_t SPS_PPS_BUFFER[] = { XCTAssertEqual(4, (int)out_header->Offset(0)); XCTAssertEqual(14, (int)out_header->Length(0)); - XCTAssertEqual(0, (int)out_header->TimeDiff(0)); - XCTAssertEqual(0, (int)out_header->PayloadType(0)); XCTAssertEqual(22, (int)out_header->Offset(1)); XCTAssertEqual(4, (int)out_header->Length(1)); - XCTAssertEqual(0, (int)out_header->TimeDiff(1)); - XCTAssertEqual(0, (int)out_header->PayloadType(1)); XCTAssertEqual(30, (int)out_header->Offset(2)); XCTAssertEqual(4, (int)out_header->Length(2)); - XCTAssertEqual(0, (int)out_header->TimeDiff(2)); - XCTAssertEqual(0, (int)out_header->PayloadType(2)); XCTAssertEqual(38, (int)out_header->Offset(3)); XCTAssertEqual(2, (int)out_header->Length(3)); - XCTAssertEqual(0, (int)out_header->TimeDiff(3)); - XCTAssertEqual(0, (int)out_header->PayloadType(3)); } - (CMVideoFormatDescriptionRef)createDescription {