Rename stereo video codec to multiplex
This CL only does the rename from"stereo" to multiplex". With this we have a better name that doesn't clash with audio's usage of stereo. Bug: webrtc:7671 Change-Id: Iebc3fc20839025f1bc8bcf0e16141bf9744ef652 Reviewed-on: https://webrtc-review.googlesource.com/43242 Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21769}
This commit is contained in:

committed by
Commit Bot

parent
2752528e4f
commit
bbdabe50db
@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_DECODER_ADAPTER_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_DECODER_ADAPTER_H_
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_DECODER_ADAPTER_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_DECODER_ADAPTER_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@ -18,16 +18,16 @@
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "api/video_codecs/video_decoder.h"
|
||||
#include "api/video_codecs/video_decoder_factory.h"
|
||||
#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
|
||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class StereoDecoderAdapter : public VideoDecoder {
|
||||
class MultiplexDecoderAdapter : public VideoDecoder {
|
||||
public:
|
||||
// |factory| is not owned and expected to outlive this class' lifetime.
|
||||
explicit StereoDecoderAdapter(VideoDecoderFactory* factory,
|
||||
const SdpVideoFormat& associated_format);
|
||||
virtual ~StereoDecoderAdapter();
|
||||
explicit MultiplexDecoderAdapter(VideoDecoderFactory* factory,
|
||||
const SdpVideoFormat& associated_format);
|
||||
virtual ~MultiplexDecoderAdapter();
|
||||
|
||||
// Implements VideoDecoder
|
||||
int32_t InitDecode(const VideoCodec* codec_settings,
|
||||
@ -56,9 +56,9 @@ class StereoDecoderAdapter : public VideoDecoder {
|
||||
void MergeAlphaImages(VideoFrame* decoded_image,
|
||||
const rtc::Optional<int32_t>& decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& qp,
|
||||
VideoFrame* stereo_decoded_image,
|
||||
const rtc::Optional<int32_t>& stereo_decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& stereo_qp);
|
||||
VideoFrame* multiplex_decoded_image,
|
||||
const rtc::Optional<int32_t>& multiplex_decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& multiplex_qp);
|
||||
|
||||
VideoDecoderFactory* const factory_;
|
||||
const SdpVideoFormat associated_format_;
|
||||
@ -72,4 +72,4 @@ class StereoDecoderAdapter : public VideoDecoder {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_DECODER_ADAPTER_H_
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_DECODER_ADAPTER_H_
|
@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -103,4 +103,4 @@ class MultiplexEncodedImagePacker {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_ENCODER_ADAPTER_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_ENCODER_ADAPTER_H_
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODER_ADAPTER_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODER_ADAPTER_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@ -18,7 +18,7 @@
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
#include "modules/video_coding/codecs/stereo/include/multiplex_encoded_image_packer.h"
|
||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoded_image_packer.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -29,12 +29,12 @@ enum AlphaCodecStream {
|
||||
kAlphaCodecStreams = 2,
|
||||
};
|
||||
|
||||
class StereoEncoderAdapter : public VideoEncoder {
|
||||
class MultiplexEncoderAdapter : public VideoEncoder {
|
||||
public:
|
||||
// |factory| is not owned and expected to outlive this class' lifetime.
|
||||
explicit StereoEncoderAdapter(VideoEncoderFactory* factory,
|
||||
const SdpVideoFormat& associated_format);
|
||||
virtual ~StereoEncoderAdapter();
|
||||
explicit MultiplexEncoderAdapter(VideoEncoderFactory* factory,
|
||||
const SdpVideoFormat& associated_format);
|
||||
virtual ~MultiplexEncoderAdapter();
|
||||
|
||||
// Implements VideoEncoder
|
||||
int InitEncode(const VideoCodec* inst,
|
||||
@ -69,7 +69,7 @@ class StereoEncoderAdapter : public VideoEncoder {
|
||||
std::map<uint32_t /* timestamp */, MultiplexImage> stashed_images_;
|
||||
|
||||
uint16_t picture_index_ = 0;
|
||||
std::vector<uint8_t> stereo_dummy_planes_;
|
||||
std::vector<uint8_t> multiplex_dummy_planes_;
|
||||
|
||||
int key_frame_interval_;
|
||||
EncodedImage combined_image_;
|
||||
@ -77,4 +77,4 @@ class StereoEncoderAdapter : public VideoEncoder {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_ENCODER_ADAPTER_H_
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODER_ADAPTER_H_
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/video_coding/codecs/stereo/include/stereo_decoder_adapter.h"
|
||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h"
|
||||
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "api/video/video_frame_buffer.h"
|
||||
@ -25,10 +25,10 @@ void KeepBufferRefs(rtc::scoped_refptr<webrtc::VideoFrameBuffer>,
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class StereoDecoderAdapter::AdapterDecodedImageCallback
|
||||
class MultiplexDecoderAdapter::AdapterDecodedImageCallback
|
||||
: public webrtc::DecodedImageCallback {
|
||||
public:
|
||||
AdapterDecodedImageCallback(webrtc::StereoDecoderAdapter* adapter,
|
||||
AdapterDecodedImageCallback(webrtc::MultiplexDecoderAdapter* adapter,
|
||||
AlphaCodecStream stream_idx)
|
||||
: adapter_(adapter), stream_idx_(stream_idx) {}
|
||||
|
||||
@ -49,11 +49,11 @@ class StereoDecoderAdapter::AdapterDecodedImageCallback
|
||||
}
|
||||
|
||||
private:
|
||||
StereoDecoderAdapter* adapter_;
|
||||
MultiplexDecoderAdapter* adapter_;
|
||||
const AlphaCodecStream stream_idx_;
|
||||
};
|
||||
|
||||
struct StereoDecoderAdapter::DecodedImageData {
|
||||
struct MultiplexDecoderAdapter::DecodedImageData {
|
||||
explicit DecodedImageData(AlphaCodecStream stream_idx)
|
||||
: stream_idx_(stream_idx),
|
||||
decoded_image_(I420Buffer::Create(1 /* width */, 1 /* height */),
|
||||
@ -79,18 +79,18 @@ struct StereoDecoderAdapter::DecodedImageData {
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DecodedImageData);
|
||||
};
|
||||
|
||||
StereoDecoderAdapter::StereoDecoderAdapter(
|
||||
MultiplexDecoderAdapter::MultiplexDecoderAdapter(
|
||||
VideoDecoderFactory* factory,
|
||||
const SdpVideoFormat& associated_format)
|
||||
: factory_(factory), associated_format_(associated_format) {}
|
||||
|
||||
StereoDecoderAdapter::~StereoDecoderAdapter() {
|
||||
MultiplexDecoderAdapter::~MultiplexDecoderAdapter() {
|
||||
Release();
|
||||
}
|
||||
|
||||
int32_t StereoDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
||||
int32_t number_of_cores) {
|
||||
RTC_DCHECK_EQ(kVideoCodecStereo, codec_settings->codecType);
|
||||
int32_t MultiplexDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
||||
int32_t number_of_cores) {
|
||||
RTC_DCHECK_EQ(kVideoCodecMultiplex, codec_settings->codecType);
|
||||
VideoCodec settings = *codec_settings;
|
||||
settings.codecType = PayloadStringToCodecType(associated_format_.name);
|
||||
for (size_t i = 0; i < kAlphaCodecStreams; ++i) {
|
||||
@ -100,7 +100,7 @@ int32_t StereoDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
||||
if (rv)
|
||||
return rv;
|
||||
adapter_callbacks_.emplace_back(
|
||||
new StereoDecoderAdapter::AdapterDecodedImageCallback(
|
||||
new MultiplexDecoderAdapter::AdapterDecodedImageCallback(
|
||||
this, static_cast<AlphaCodecStream>(i)));
|
||||
decoder->RegisterDecodeCompleteCallback(adapter_callbacks_.back().get());
|
||||
decoders_.emplace_back(std::move(decoder));
|
||||
@ -108,7 +108,7 @@ int32_t StereoDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int32_t StereoDecoderAdapter::Decode(
|
||||
int32_t MultiplexDecoderAdapter::Decode(
|
||||
const EncodedImage& input_image,
|
||||
bool missing_frames,
|
||||
const RTPFragmentationHeader* /*fragmentation*/,
|
||||
@ -135,13 +135,13 @@ int32_t StereoDecoderAdapter::Decode(
|
||||
return rv;
|
||||
}
|
||||
|
||||
int32_t StereoDecoderAdapter::RegisterDecodeCompleteCallback(
|
||||
int32_t MultiplexDecoderAdapter::RegisterDecodeCompleteCallback(
|
||||
DecodedImageCallback* callback) {
|
||||
decoded_complete_callback_ = callback;
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int32_t StereoDecoderAdapter::Release() {
|
||||
int32_t MultiplexDecoderAdapter::Release() {
|
||||
for (auto& decoder : decoders_) {
|
||||
const int32_t rv = decoder->Release();
|
||||
if (rv)
|
||||
@ -152,10 +152,10 @@ int32_t StereoDecoderAdapter::Release() {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
void StereoDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
||||
VideoFrame* decoded_image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) {
|
||||
void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
||||
VideoFrame* decoded_image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) {
|
||||
const auto& other_decoded_data_it =
|
||||
decoded_data_.find(decoded_image->timestamp());
|
||||
if (other_decoded_data_it != decoded_data_.end()) {
|
||||
@ -183,7 +183,7 @@ void StereoDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
||||
std::forward_as_tuple(stream_idx, *decoded_image, decode_time_ms, qp));
|
||||
}
|
||||
|
||||
void StereoDecoderAdapter::MergeAlphaImages(
|
||||
void MultiplexDecoderAdapter::MergeAlphaImages(
|
||||
VideoFrame* decoded_image,
|
||||
const rtc::Optional<int32_t>& decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& qp,
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/video_coding/codecs/stereo/include/multiplex_encoded_image_packer.h"
|
||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoded_image_packer.h"
|
||||
|
||||
#include <cstring>
|
||||
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
|
||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@ -23,10 +23,10 @@ namespace webrtc {
|
||||
|
||||
// Callback wrapper that helps distinguish returned results from |encoders_|
|
||||
// instances.
|
||||
class StereoEncoderAdapter::AdapterEncodedImageCallback
|
||||
class MultiplexEncoderAdapter::AdapterEncodedImageCallback
|
||||
: public webrtc::EncodedImageCallback {
|
||||
public:
|
||||
AdapterEncodedImageCallback(webrtc::StereoEncoderAdapter* adapter,
|
||||
AdapterEncodedImageCallback(webrtc::MultiplexEncoderAdapter* adapter,
|
||||
AlphaCodecStream stream_idx)
|
||||
: adapter_(adapter), stream_idx_(stream_idx) {}
|
||||
|
||||
@ -41,31 +41,32 @@ class StereoEncoderAdapter::AdapterEncodedImageCallback
|
||||
}
|
||||
|
||||
private:
|
||||
StereoEncoderAdapter* adapter_;
|
||||
MultiplexEncoderAdapter* adapter_;
|
||||
const AlphaCodecStream stream_idx_;
|
||||
};
|
||||
|
||||
StereoEncoderAdapter::StereoEncoderAdapter(
|
||||
MultiplexEncoderAdapter::MultiplexEncoderAdapter(
|
||||
VideoEncoderFactory* factory,
|
||||
const SdpVideoFormat& associated_format)
|
||||
: factory_(factory),
|
||||
associated_format_(associated_format),
|
||||
encoded_complete_callback_(nullptr) {}
|
||||
|
||||
StereoEncoderAdapter::~StereoEncoderAdapter() {
|
||||
MultiplexEncoderAdapter::~MultiplexEncoderAdapter() {
|
||||
Release();
|
||||
}
|
||||
|
||||
int StereoEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||
int number_of_cores,
|
||||
size_t max_payload_size) {
|
||||
int MultiplexEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||
int number_of_cores,
|
||||
size_t max_payload_size) {
|
||||
const size_t buffer_size =
|
||||
CalcBufferSize(VideoType::kI420, inst->width, inst->height);
|
||||
stereo_dummy_planes_.resize(buffer_size);
|
||||
multiplex_dummy_planes_.resize(buffer_size);
|
||||
// It is more expensive to encode 0x00, so use 0x80 instead.
|
||||
std::fill(stereo_dummy_planes_.begin(), stereo_dummy_planes_.end(), 0x80);
|
||||
std::fill(multiplex_dummy_planes_.begin(), multiplex_dummy_planes_.end(),
|
||||
0x80);
|
||||
|
||||
RTC_DCHECK_EQ(kVideoCodecStereo, inst->codecType);
|
||||
RTC_DCHECK_EQ(kVideoCodecMultiplex, inst->codecType);
|
||||
VideoCodec settings = *inst;
|
||||
settings.codecType = PayloadStringToCodecType(associated_format_.name);
|
||||
|
||||
@ -94,7 +95,7 @@ int StereoEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||
const int rv =
|
||||
encoder->InitEncode(&settings, number_of_cores, max_payload_size);
|
||||
if (rv) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to create stereo codec index " << i;
|
||||
RTC_LOG(LS_ERROR) << "Failed to create multiplex codec index " << i;
|
||||
return rv;
|
||||
}
|
||||
adapter_callbacks_.emplace_back(new AdapterEncodedImageCallback(
|
||||
@ -105,9 +106,10 @@ int StereoEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int StereoEncoderAdapter::Encode(const VideoFrame& input_image,
|
||||
const CodecSpecificInfo* codec_specific_info,
|
||||
const std::vector<FrameType>* frame_types) {
|
||||
int MultiplexEncoderAdapter::Encode(
|
||||
const VideoFrame& input_image,
|
||||
const CodecSpecificInfo* codec_specific_info,
|
||||
const std::vector<FrameType>* frame_types) {
|
||||
if (!encoded_complete_callback_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
@ -142,8 +144,8 @@ int StereoEncoderAdapter::Encode(const VideoFrame& input_image,
|
||||
rtc::scoped_refptr<I420BufferInterface> alpha_buffer =
|
||||
WrapI420Buffer(input_image.width(), input_image.height(),
|
||||
yuva_buffer->DataA(), yuva_buffer->StrideA(),
|
||||
stereo_dummy_planes_.data(), yuva_buffer->StrideU(),
|
||||
stereo_dummy_planes_.data(), yuva_buffer->StrideV(),
|
||||
multiplex_dummy_planes_.data(), yuva_buffer->StrideU(),
|
||||
multiplex_dummy_planes_.data(), yuva_buffer->StrideV(),
|
||||
rtc::KeepRefUntilDone(input_image.video_frame_buffer()));
|
||||
VideoFrame alpha_image(alpha_buffer, input_image.timestamp(),
|
||||
input_image.render_time_ms(), input_image.rotation());
|
||||
@ -152,14 +154,14 @@ int StereoEncoderAdapter::Encode(const VideoFrame& input_image,
|
||||
return rv;
|
||||
}
|
||||
|
||||
int StereoEncoderAdapter::RegisterEncodeCompleteCallback(
|
||||
int MultiplexEncoderAdapter::RegisterEncodeCompleteCallback(
|
||||
EncodedImageCallback* callback) {
|
||||
encoded_complete_callback_ = callback;
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int StereoEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
||||
int64_t rtt) {
|
||||
int MultiplexEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
||||
int64_t rtt) {
|
||||
for (auto& encoder : encoders_) {
|
||||
const int rv = encoder->SetChannelParameters(packet_loss, rtt);
|
||||
if (rv)
|
||||
@ -168,8 +170,8 @@ int StereoEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int StereoEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
|
||||
uint32_t framerate) {
|
||||
int MultiplexEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
|
||||
uint32_t framerate) {
|
||||
for (auto& encoder : encoders_) {
|
||||
// TODO(emircan): |framerate| is used to calculate duration in encoder
|
||||
// instances. We report the total frame rate to keep real time for now.
|
||||
@ -182,7 +184,7 @@ int StereoEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int StereoEncoderAdapter::Release() {
|
||||
int MultiplexEncoderAdapter::Release() {
|
||||
for (auto& encoder : encoders_) {
|
||||
const int rv = encoder->Release();
|
||||
if (rv)
|
||||
@ -203,11 +205,11 @@ int StereoEncoderAdapter::Release() {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
const char* StereoEncoderAdapter::ImplementationName() const {
|
||||
return "StereoEncoderAdapter";
|
||||
const char* MultiplexEncoderAdapter::ImplementationName() const {
|
||||
return "MultiplexEncoderAdapter";
|
||||
}
|
||||
|
||||
EncodedImageCallback::Result StereoEncoderAdapter::OnEncodedImage(
|
||||
EncodedImageCallback::Result MultiplexEncoderAdapter::OnEncodedImage(
|
||||
AlphaCodecStream stream_idx,
|
||||
const EncodedImage& encodedImage,
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
@ -246,7 +248,7 @@ EncodedImageCallback::Result StereoEncoderAdapter::OnEncodedImage(
|
||||
MultiplexEncodedImagePacker::PackAndRelease(iter->second);
|
||||
|
||||
CodecSpecificInfo codec_info = *codecSpecificInfo;
|
||||
codec_info.codecType = kVideoCodecStereo;
|
||||
codec_info.codecType = kVideoCodecMultiplex;
|
||||
codec_info.codecSpecific.generic.simulcast_idx = 0;
|
||||
encoded_complete_callback_->OnEncodedImage(combined_image_, &codec_info,
|
||||
fragmentation);
|
@ -14,8 +14,8 @@
|
||||
#include "common_video/include/video_frame_buffer.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "media/base/mediaconstants.h"
|
||||
#include "modules/video_coding/codecs/stereo/include/stereo_decoder_adapter.h"
|
||||
#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
|
||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h"
|
||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
||||
#include "modules/video_coding/codecs/test/video_codec_test.h"
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
#include "rtc_base/keep_ref_until_done.h"
|
||||
@ -26,33 +26,33 @@ using testing::Return;
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
constexpr const char* kStereoAssociatedCodecName = cricket::kVp9CodecName;
|
||||
const VideoCodecType kStereoAssociatedCodecType =
|
||||
PayloadStringToCodecType(kStereoAssociatedCodecName);
|
||||
constexpr const char* kMultiplexAssociatedCodecName = cricket::kVp9CodecName;
|
||||
const VideoCodecType kMultiplexAssociatedCodecType =
|
||||
PayloadStringToCodecType(kMultiplexAssociatedCodecName);
|
||||
|
||||
class TestStereoAdapter : public VideoCodecTest {
|
||||
class TestMultiplexAdapter : public VideoCodecTest {
|
||||
public:
|
||||
TestStereoAdapter()
|
||||
TestMultiplexAdapter()
|
||||
: decoder_factory_(new webrtc::MockVideoDecoderFactory),
|
||||
encoder_factory_(new webrtc::MockVideoEncoderFactory) {}
|
||||
|
||||
protected:
|
||||
std::unique_ptr<VideoDecoder> CreateDecoder() override {
|
||||
return rtc::MakeUnique<StereoDecoderAdapter>(
|
||||
decoder_factory_.get(), SdpVideoFormat(kStereoAssociatedCodecName));
|
||||
return rtc::MakeUnique<MultiplexDecoderAdapter>(
|
||||
decoder_factory_.get(), SdpVideoFormat(kMultiplexAssociatedCodecName));
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoEncoder> CreateEncoder() override {
|
||||
return rtc::MakeUnique<StereoEncoderAdapter>(
|
||||
encoder_factory_.get(), SdpVideoFormat(kStereoAssociatedCodecName));
|
||||
return rtc::MakeUnique<MultiplexEncoderAdapter>(
|
||||
encoder_factory_.get(), SdpVideoFormat(kMultiplexAssociatedCodecName));
|
||||
}
|
||||
|
||||
VideoCodec codec_settings() override {
|
||||
VideoCodec codec_settings;
|
||||
codec_settings.codecType = kStereoAssociatedCodecType;
|
||||
codec_settings.codecType = kMultiplexAssociatedCodecType;
|
||||
codec_settings.VP9()->numberOfTemporalLayers = 1;
|
||||
codec_settings.VP9()->numberOfSpatialLayers = 1;
|
||||
codec_settings.codecType = webrtc::kVideoCodecStereo;
|
||||
codec_settings.codecType = webrtc::kVideoCodecMultiplex;
|
||||
return codec_settings;
|
||||
}
|
||||
|
||||
@ -96,22 +96,22 @@ class TestStereoAdapter : public VideoCodecTest {
|
||||
// TODO(emircan): Currently VideoCodecTest tests do a complete setup
|
||||
// step that goes beyond constructing |decoder_|. Simplify these tests to do
|
||||
// less.
|
||||
TEST_F(TestStereoAdapter, ConstructAndDestructDecoder) {
|
||||
TEST_F(TestMultiplexAdapter, ConstructAndDestructDecoder) {
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release());
|
||||
}
|
||||
|
||||
TEST_F(TestStereoAdapter, ConstructAndDestructEncoder) {
|
||||
TEST_F(TestMultiplexAdapter, ConstructAndDestructEncoder) {
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release());
|
||||
}
|
||||
|
||||
TEST_F(TestStereoAdapter, EncodeDecodeI420Frame) {
|
||||
TEST_F(TestMultiplexAdapter, EncodeDecodeI420Frame) {
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder_->Encode(*input_frame_, nullptr, nullptr));
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
||||
|
||||
EXPECT_EQ(kVideoCodecStereo, codec_specific_info.codecType);
|
||||
EXPECT_EQ(kVideoCodecMultiplex, codec_specific_info.codecType);
|
||||
|
||||
EXPECT_EQ(
|
||||
WEBRTC_VIDEO_CODEC_OK,
|
||||
@ -123,7 +123,7 @@ TEST_F(TestStereoAdapter, EncodeDecodeI420Frame) {
|
||||
EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36);
|
||||
}
|
||||
|
||||
TEST_F(TestStereoAdapter, EncodeDecodeI420AFrame) {
|
||||
TEST_F(TestMultiplexAdapter, EncodeDecodeI420AFrame) {
|
||||
std::unique_ptr<VideoFrame> yuva_frame = CreateI420AInputFrame();
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
encoder_->Encode(*yuva_frame, nullptr, nullptr));
|
||||
@ -131,7 +131,7 @@ TEST_F(TestStereoAdapter, EncodeDecodeI420AFrame) {
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
||||
|
||||
EXPECT_EQ(kVideoCodecStereo, codec_specific_info.codecType);
|
||||
EXPECT_EQ(kVideoCodecMultiplex, codec_specific_info.codecType);
|
||||
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, nullptr));
|
Reference in New Issue
Block a user