Revert "Add stereo codec header and pass it through RTP"
This reverts commit 20f2133d5dbd1591b89425b24db3b1e09fbcf0b1. Reason for revert: Breaks downstream project. Original change's description: > Add stereo codec header and pass it through RTP > > - Defines CodecSpecificInfoStereo that carries stereo specific header info from > encoded image. > - Defines RTPVideoHeaderStereo that carries the above info to packetizer, > see module_common_types.h. > - Adds an RTPPacketizer and RTPDepacketizer that supports passing specific stereo > header. > - Uses new data containers in StereoAdapter classes. > > This CL is the step 3 for adding alpha channel support over the wire in webrtc. > See https://webrtc-review.googlesource.com/c/src/+/7800 for the experimental > CL that gives an idea about how it will come together. > Design Doc: https://goo.gl/sFeSUT > > Bug: webrtc:7671 > Change-Id: Ia932568fdd7065ba104afd2bc0ecf25a765748ab > Reviewed-on: https://webrtc-review.googlesource.com/22900 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20920} TBR=danilchap@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,niklas.enbom@webrtc.org,emircan@webrtc.org Change-Id: I57f3172ca3c60a84537d577a574dc8018e12d634 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/26940 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20931}
This commit is contained in:
committed by
Commit Bot
parent
f82000328d
commit
deb866360a
@ -44,20 +44,6 @@ class StereoEncoderAdapter::AdapterEncodedImageCallback
|
||||
const AlphaCodecStream stream_idx_;
|
||||
};
|
||||
|
||||
// Holds the encoded image info.
|
||||
struct StereoEncoderAdapter::ImageStereoInfo {
|
||||
ImageStereoInfo(uint16_t picture_index, uint8_t frame_count)
|
||||
: picture_index(picture_index),
|
||||
frame_count(frame_count),
|
||||
encoded_count(0) {}
|
||||
uint16_t picture_index;
|
||||
uint8_t frame_count;
|
||||
uint8_t encoded_count;
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ImageStereoInfo);
|
||||
};
|
||||
|
||||
StereoEncoderAdapter::StereoEncoderAdapter(VideoEncoderFactory* factory)
|
||||
: factory_(factory), encoded_complete_callback_(nullptr) {}
|
||||
|
||||
@ -97,21 +83,15 @@ int StereoEncoderAdapter::Encode(const VideoFrame& input_image,
|
||||
if (!encoded_complete_callback_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
|
||||
const bool has_alpha = input_image.video_frame_buffer()->type() ==
|
||||
VideoFrameBuffer::Type::kI420A;
|
||||
image_stereo_info_.emplace(
|
||||
std::piecewise_construct, std::forward_as_tuple(input_image.timestamp()),
|
||||
std::forward_as_tuple(picture_index_++,
|
||||
has_alpha ? kAlphaCodecStreams : 1));
|
||||
|
||||
// Encode YUV
|
||||
int rv = encoders_[kYUVStream]->Encode(input_image, codec_specific_info,
|
||||
frame_types);
|
||||
// If we do not receive an alpha frame, we send a single frame for this
|
||||
// |picture_index_|. The receiver will receive |frame_count| as 1 which
|
||||
// soecifies this case.
|
||||
if (rv || !has_alpha)
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
const bool has_alpha = input_image.video_frame_buffer()->type() ==
|
||||
VideoFrameBuffer::Type::kI420A;
|
||||
if (!has_alpha)
|
||||
return rv;
|
||||
|
||||
// Encode AXX
|
||||
@ -149,7 +129,7 @@ int StereoEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
||||
int StereoEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
|
||||
uint32_t framerate) {
|
||||
for (auto& encoder : encoders_) {
|
||||
// TODO(emircan): |framerate| is used to calculate duration in encoder
|
||||
// TODO(emircan): |new_framerate| is used to calculate duration for encoder
|
||||
// instances. We report the total frame rate to keep real time for now.
|
||||
// Remove this after refactoring duration logic.
|
||||
const int rv = encoder->SetRateAllocation(
|
||||
@ -180,25 +160,11 @@ EncodedImageCallback::Result StereoEncoderAdapter::OnEncodedImage(
|
||||
const EncodedImage& encodedImage,
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
const VideoCodecType associated_coded_type = codecSpecificInfo->codecType;
|
||||
const auto& image_stereo_info_itr =
|
||||
image_stereo_info_.find(encodedImage._timeStamp);
|
||||
RTC_DCHECK(image_stereo_info_itr != image_stereo_info_.end());
|
||||
ImageStereoInfo& image_stereo_info = image_stereo_info_itr->second;
|
||||
const uint8_t frame_count = image_stereo_info.frame_count;
|
||||
const uint16_t picture_index = image_stereo_info.picture_index;
|
||||
if (++image_stereo_info.encoded_count == frame_count)
|
||||
image_stereo_info_.erase(image_stereo_info_itr);
|
||||
if (stream_idx == kAXXStream)
|
||||
return EncodedImageCallback::Result(EncodedImageCallback::Result::OK);
|
||||
|
||||
CodecSpecificInfo codec_info = *codecSpecificInfo;
|
||||
codec_info.codecType = kVideoCodecStereo;
|
||||
codec_info.codec_name = "stereo";
|
||||
codec_info.codecSpecific.stereo.associated_codec_type = associated_coded_type;
|
||||
codec_info.codecSpecific.stereo.indices.frame_index = stream_idx;
|
||||
codec_info.codecSpecific.stereo.indices.frame_count = frame_count;
|
||||
codec_info.codecSpecific.stereo.indices.picture_index = picture_index;
|
||||
|
||||
encoded_complete_callback_->OnEncodedImage(encodedImage, &codec_info,
|
||||
// TODO(emircan): Fill |codec_specific_info| with stereo parameters.
|
||||
encoded_complete_callback_->OnEncodedImage(encodedImage, codecSpecificInfo,
|
||||
fragmentation);
|
||||
return EncodedImageCallback::Result(EncodedImageCallback::Result::OK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user