Cleanup of unused RTP structs and packetizer for stereo codec

This CL is a followup to https://webrtc-review.googlesource.com/c/src/+/38481.
With the new approach we can just use the generic RTP packetizer to pass frames
over the wire as the specific info is contained within the bitstream. This makes
the new codec more modular and reduces its footprint.

Bug: webrtc:7671
Change-Id: Ib07f72a9d338e3cbfdbf39cba9891a959b5f7552
Reviewed-on: https://webrtc-review.googlesource.com/43220
Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org>
Commit-Queue: Emircan Uysaler <emircan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21753}
This commit is contained in:
Emircan Uysaler
2018-01-23 15:53:06 -08:00
committed by Commit Bot
parent be5e208b3e
commit 9bb8f0553d
16 changed files with 15 additions and 454 deletions

View File

@ -160,7 +160,6 @@ rtc_source_set("codec_globals_headers") {
sources = [
"codecs/h264/include/h264_globals.h",
"codecs/interface/common_constants.h",
"codecs/stereo/include/stereo_globals.h",
"codecs/vp8/include/vp8_globals.h",
"codecs/vp9/include/vp9_globals.h",
]

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 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.
*/
#ifndef MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_GLOBALS_H_
#define MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_GLOBALS_H_
namespace webrtc {
struct StereoIndices {
uint8_t frame_index;
uint8_t frame_count;
uint16_t picture_index;
};
} // namespace webrtc
#endif // MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_GLOBALS_H_

View File

@ -212,8 +212,6 @@ EncodedImageCallback::Result StereoEncoderAdapter::OnEncodedImage(
const EncodedImage& encodedImage,
const CodecSpecificInfo* codecSpecificInfo,
const RTPFragmentationHeader* fragmentation) {
CodecSpecificInfo codec_info = *codecSpecificInfo;
codec_info.codecType = kVideoCodecStereo;
const auto& stashed_image_itr = stashed_images_.find(encodedImage._timeStamp);
const auto& stashed_image_next_itr = std::next(stashed_image_itr, 1);
RTC_DCHECK(stashed_image_itr != stashed_images_.end());
@ -246,6 +244,10 @@ EncodedImageCallback::Result StereoEncoderAdapter::OnEncodedImage(
delete[] combined_image_._buffer;
combined_image_ =
MultiplexEncodedImagePacker::PackAndRelease(iter->second);
CodecSpecificInfo codec_info = *codecSpecificInfo;
codec_info.codecType = kVideoCodecStereo;
codec_info.codecSpecific.generic.simulcast_idx = 0;
encoded_complete_callback_->OnEncodedImage(combined_image_, &codec_info,
fragmentation);
iter++;

View File

@ -193,29 +193,8 @@ void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) {
_codecSpecificInfo.codecType = kVideoCodecH264;
break;
}
case kRtpVideoStereo: {
_codecSpecificInfo.codecType = kVideoCodecStereo;
VideoCodecType associated_codec_type = kVideoCodecUnknown;
switch (header->codecHeader.stereo.associated_codec_type) {
case kRtpVideoVp8:
associated_codec_type = kVideoCodecVP8;
break;
case kRtpVideoVp9:
associated_codec_type = kVideoCodecVP9;
break;
case kRtpVideoH264:
associated_codec_type = kVideoCodecH264;
break;
default:
RTC_NOTREACHED();
}
_codecSpecificInfo.codecSpecific.stereo.associated_codec_type =
associated_codec_type;
_codecSpecificInfo.codecSpecific.stereo.indices =
header->codecHeader.stereo.indices;
break;
}
default: {
case kRtpVideoNone:
case kRtpVideoGeneric: {
_codecSpecificInfo.codecType = kVideoCodecUnknown;
break;
}

View File

@ -43,14 +43,9 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
frame_type_ = first_packet->frameType;
codec_type_ = first_packet->codec;
// Stereo codec appends CopyCodecSpecific to last packet to avoid copy.
VCMPacket* packet_with_codec_specific =
codec_type_ == kVideoCodecStereo ? packet_buffer_->GetPacket(last_seq_num)
: first_packet;
// TODO(philipel): Remove when encoded image is replaced by FrameObject.
// VCMEncodedFrame members
CopyCodecSpecific(&packet_with_codec_specific->video_header);
CopyCodecSpecific(&first_packet->video_header);
_completeFrame = true;
_payloadType = first_packet->payloadType;
_timeStamp = first_packet->timestamp;

View File

@ -73,17 +73,11 @@ struct CodecSpecificInfoH264 {
H264PacketizationMode packetization_mode;
};
struct CodecSpecificInfoStereo {
VideoCodecType associated_codec_type;
StereoIndices indices;
};
union CodecSpecificInfoUnion {
CodecSpecificInfoGeneric generic;
CodecSpecificInfoVP8 VP8;
CodecSpecificInfoVP9 VP9;
CodecSpecificInfoH264 H264;
CodecSpecificInfoStereo stereo;
};
// Note: if any pointers are added to this struct or its sub-structs, it

View File

@ -133,9 +133,6 @@ void VCMPacket::CopyCodecSpecifics(const RTPVideoHeader& videoHeader) {
}
codec = kVideoCodecH264;
return;
case kRtpVideoStereo:
codec = kVideoCodecStereo;
return;
case kRtpVideoGeneric:
codec = kVideoCodecGeneric;
return;