Revert "Reland "Rename stereo video codec to multiplex""
This reverts commit 4954a77cf81e6793245f52d485834acd3e6eab1c. Reason for revert: Breaks downstream build which was depending on the name "kVideoCodecStereo". Will need to do some sort of trickery to make this change without breaking the relevant code. Sorry. :( Original change's description: > Reland "Rename stereo video codec to multiplex" > > This is a reland of bbdabe50db0cf09f6007dda12a6476dc4602b174. > This was reverted because of breaking internal build. I contacted sheriff > and looked at logs but cannot find anything related to this CL. This was landed > with #3850 build which caused exception, but 3847-3855 seem to all have failed. > I am relanding to see if it will work this time or it will give some related > error message that can guide me. > > Original change's description: > > 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} > > TBR=niklas.enbom@webrtc.org > > Bug: webrtc:7671 > Change-Id: I5934abad1ce28acf02842ea8ee2af7768a826eb8 > Reviewed-on: https://webrtc-review.googlesource.com/44520 > Reviewed-by: Emircan Uysaler <emircan@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#21780} TBR=sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: I0a71327c2ddfdd030b1e058cd6a41b1689836719 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/44621 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21783}
This commit is contained in:

committed by
Commit Bot

parent
74255ffb39
commit
1204448a68
@ -78,7 +78,7 @@ static const char* kPayloadNameI420 = "I420";
|
|||||||
static const char* kPayloadNameRED = "RED";
|
static const char* kPayloadNameRED = "RED";
|
||||||
static const char* kPayloadNameULPFEC = "ULPFEC";
|
static const char* kPayloadNameULPFEC = "ULPFEC";
|
||||||
static const char* kPayloadNameGeneric = "Generic";
|
static const char* kPayloadNameGeneric = "Generic";
|
||||||
static const char* kPayloadNameMultiplex = "Multiplex";
|
static const char* kPayloadNameStereo = "Stereo";
|
||||||
|
|
||||||
static bool CodecNamesEq(const char* name1, const char* name2) {
|
static bool CodecNamesEq(const char* name1, const char* name2) {
|
||||||
return _stricmp(name1, name2) == 0;
|
return _stricmp(name1, name2) == 0;
|
||||||
@ -99,7 +99,7 @@ const char* CodecTypeToPayloadString(VideoCodecType type) {
|
|||||||
case kVideoCodecULPFEC:
|
case kVideoCodecULPFEC:
|
||||||
return kPayloadNameULPFEC;
|
return kPayloadNameULPFEC;
|
||||||
// Other codecs default to generic.
|
// Other codecs default to generic.
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecStereo:
|
||||||
case kVideoCodecFlexfec:
|
case kVideoCodecFlexfec:
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
case kVideoCodecUnknown:
|
case kVideoCodecUnknown:
|
||||||
@ -121,8 +121,8 @@ VideoCodecType PayloadStringToCodecType(const std::string& name) {
|
|||||||
return kVideoCodecRED;
|
return kVideoCodecRED;
|
||||||
if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC))
|
if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC))
|
||||||
return kVideoCodecULPFEC;
|
return kVideoCodecULPFEC;
|
||||||
if (CodecNamesEq(name.c_str(), kPayloadNameMultiplex))
|
if (CodecNamesEq(name.c_str(), kPayloadNameStereo))
|
||||||
return kVideoCodecMultiplex;
|
return kVideoCodecStereo;
|
||||||
return kVideoCodecGeneric;
|
return kVideoCodecGeneric;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ enum VideoCodecType {
|
|||||||
kVideoCodecULPFEC,
|
kVideoCodecULPFEC,
|
||||||
kVideoCodecFlexfec,
|
kVideoCodecFlexfec,
|
||||||
kVideoCodecGeneric,
|
kVideoCodecGeneric,
|
||||||
kVideoCodecMultiplex,
|
kVideoCodecStereo,
|
||||||
kVideoCodecUnknown
|
kVideoCodecUnknown
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) {
|
|||||||
case kVideoCodecULPFEC:
|
case kVideoCodecULPFEC:
|
||||||
case kVideoCodecFlexfec:
|
case kVideoCodecFlexfec:
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecStereo:
|
||||||
case kVideoCodecUnknown:
|
case kVideoCodecUnknown:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -164,8 +164,6 @@ rtc_static_library("rtc_internal_video_codecs") {
|
|||||||
"engine/internaldecoderfactory.h",
|
"engine/internaldecoderfactory.h",
|
||||||
"engine/internalencoderfactory.cc",
|
"engine/internalencoderfactory.cc",
|
||||||
"engine/internalencoderfactory.h",
|
"engine/internalencoderfactory.h",
|
||||||
"engine/multiplexcodecfactory.cc",
|
|
||||||
"engine/multiplexcodecfactory.h",
|
|
||||||
"engine/scopedvideodecoder.cc",
|
"engine/scopedvideodecoder.cc",
|
||||||
"engine/scopedvideodecoder.h",
|
"engine/scopedvideodecoder.h",
|
||||||
"engine/scopedvideoencoder.cc",
|
"engine/scopedvideoencoder.cc",
|
||||||
@ -174,6 +172,8 @@ rtc_static_library("rtc_internal_video_codecs") {
|
|||||||
"engine/simulcast.h",
|
"engine/simulcast.h",
|
||||||
"engine/simulcast_encoder_adapter.cc",
|
"engine/simulcast_encoder_adapter.cc",
|
||||||
"engine/simulcast_encoder_adapter.h",
|
"engine/simulcast_encoder_adapter.h",
|
||||||
|
"engine/stereocodecfactory.cc",
|
||||||
|
"engine/stereocodecfactory.h",
|
||||||
"engine/videodecodersoftwarefallbackwrapper.cc",
|
"engine/videodecodersoftwarefallbackwrapper.cc",
|
||||||
"engine/videodecodersoftwarefallbackwrapper.h",
|
"engine/videodecodersoftwarefallbackwrapper.h",
|
||||||
"engine/videoencodersoftwarefallbackwrapper.cc",
|
"engine/videoencodersoftwarefallbackwrapper.cc",
|
||||||
@ -213,7 +213,7 @@ rtc_static_library("rtc_internal_video_codecs") {
|
|||||||
"../call:call_interfaces",
|
"../call:call_interfaces",
|
||||||
"../call:video_stream_api",
|
"../call:video_stream_api",
|
||||||
"../modules/video_coding:webrtc_h264",
|
"../modules/video_coding:webrtc_h264",
|
||||||
"../modules/video_coding:webrtc_multiplex",
|
"../modules/video_coding:webrtc_stereo",
|
||||||
"../modules/video_coding:webrtc_vp8",
|
"../modules/video_coding:webrtc_vp8",
|
||||||
"../modules/video_coding:webrtc_vp8_helpers",
|
"../modules/video_coding:webrtc_vp8_helpers",
|
||||||
"../modules/video_coding:webrtc_vp9",
|
"../modules/video_coding:webrtc_vp9",
|
||||||
@ -529,11 +529,11 @@ if (rtc_include_tests) {
|
|||||||
"base/videoengine_unittest.h",
|
"base/videoengine_unittest.h",
|
||||||
"engine/apm_helpers_unittest.cc",
|
"engine/apm_helpers_unittest.cc",
|
||||||
"engine/internaldecoderfactory_unittest.cc",
|
"engine/internaldecoderfactory_unittest.cc",
|
||||||
"engine/multiplexcodecfactory_unittest.cc",
|
|
||||||
"engine/nullwebrtcvideoengine_unittest.cc",
|
"engine/nullwebrtcvideoengine_unittest.cc",
|
||||||
"engine/payload_type_mapper_unittest.cc",
|
"engine/payload_type_mapper_unittest.cc",
|
||||||
"engine/simulcast_encoder_adapter_unittest.cc",
|
"engine/simulcast_encoder_adapter_unittest.cc",
|
||||||
"engine/simulcast_unittest.cc",
|
"engine/simulcast_unittest.cc",
|
||||||
|
"engine/stereocodecfactory_unittest.cc",
|
||||||
"engine/videodecodersoftwarefallbackwrapper_unittest.cc",
|
"engine/videodecodersoftwarefallbackwrapper_unittest.cc",
|
||||||
"engine/videoencodersoftwarefallbackwrapper_unittest.cc",
|
"engine/videoencodersoftwarefallbackwrapper_unittest.cc",
|
||||||
"engine/vp8_encoder_simulcast_proxy_unittest.cc",
|
"engine/vp8_encoder_simulcast_proxy_unittest.cc",
|
||||||
|
@ -25,7 +25,7 @@ const float kProcessCpuThreshold = 0.10f;
|
|||||||
const char kRtxCodecName[] = "rtx";
|
const char kRtxCodecName[] = "rtx";
|
||||||
const char kRedCodecName[] = "red";
|
const char kRedCodecName[] = "red";
|
||||||
const char kUlpfecCodecName[] = "ulpfec";
|
const char kUlpfecCodecName[] = "ulpfec";
|
||||||
const char kMultiplexCodecName[] = "multiplex";
|
const char kStereoCodecName[] = "stereo";
|
||||||
|
|
||||||
// TODO(brandtr): Change this to 'flexfec' when we are confident that the
|
// TODO(brandtr): Change this to 'flexfec' when we are confident that the
|
||||||
// header format is not changing anymore.
|
// header format is not changing anymore.
|
||||||
|
@ -30,7 +30,7 @@ extern const char kRtxCodecName[];
|
|||||||
extern const char kRedCodecName[];
|
extern const char kRedCodecName[];
|
||||||
extern const char kUlpfecCodecName[];
|
extern const char kUlpfecCodecName[];
|
||||||
extern const char kFlexfecCodecName[];
|
extern const char kFlexfecCodecName[];
|
||||||
extern const char kMultiplexCodecName[];
|
extern const char kStereoCodecName[];
|
||||||
|
|
||||||
extern const char kFlexfecFmtpRepairWindow[];
|
extern const char kFlexfecFmtpRepairWindow[];
|
||||||
|
|
||||||
|
@ -1,114 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "media/engine/multiplexcodecfactory.h"
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include "api/video_codecs/sdp_video_format.h"
|
|
||||||
#include "media/base/codec.h"
|
|
||||||
#include "media/base/mediaconstants.h"
|
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h"
|
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
|
||||||
#include "rtc_base/logging.h"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool IsMultiplexCodec(const cricket::VideoCodec& codec) {
|
|
||||||
return cricket::CodecNamesEq(codec.name.c_str(),
|
|
||||||
cricket::kMultiplexCodecName);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
constexpr const char* kMultiplexAssociatedCodecName = cricket::kVp9CodecName;
|
|
||||||
|
|
||||||
MultiplexEncoderFactory::MultiplexEncoderFactory(
|
|
||||||
std::unique_ptr<VideoEncoderFactory> factory)
|
|
||||||
: factory_(std::move(factory)) {}
|
|
||||||
|
|
||||||
std::vector<SdpVideoFormat> MultiplexEncoderFactory::GetSupportedFormats()
|
|
||||||
const {
|
|
||||||
std::vector<SdpVideoFormat> formats = factory_->GetSupportedFormats();
|
|
||||||
for (const auto& format : formats) {
|
|
||||||
if (cricket::CodecNamesEq(format.name, kMultiplexAssociatedCodecName)) {
|
|
||||||
SdpVideoFormat multiplex_format = format;
|
|
||||||
multiplex_format.parameters[cricket::kCodecParamAssociatedCodecName] =
|
|
||||||
format.name;
|
|
||||||
multiplex_format.name = cricket::kMultiplexCodecName;
|
|
||||||
formats.push_back(multiplex_format);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return formats;
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoEncoderFactory::CodecInfo MultiplexEncoderFactory::QueryVideoEncoder(
|
|
||||||
const SdpVideoFormat& format) const {
|
|
||||||
if (!IsMultiplexCodec(cricket::VideoCodec(format)))
|
|
||||||
return factory_->QueryVideoEncoder(format);
|
|
||||||
return factory_->QueryVideoEncoder(
|
|
||||||
SdpVideoFormat(kMultiplexAssociatedCodecName));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<VideoEncoder> MultiplexEncoderFactory::CreateVideoEncoder(
|
|
||||||
const SdpVideoFormat& format) {
|
|
||||||
if (!IsMultiplexCodec(cricket::VideoCodec(format)))
|
|
||||||
return factory_->CreateVideoEncoder(format);
|
|
||||||
const auto& it =
|
|
||||||
format.parameters.find(cricket::kCodecParamAssociatedCodecName);
|
|
||||||
if (it == format.parameters.end()) {
|
|
||||||
RTC_LOG(LS_ERROR) << "No assicated codec for multiplex.";
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
SdpVideoFormat associated_format = format;
|
|
||||||
associated_format.name = it->second;
|
|
||||||
return std::unique_ptr<VideoEncoder>(
|
|
||||||
new MultiplexEncoderAdapter(factory_.get(), associated_format));
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiplexDecoderFactory::MultiplexDecoderFactory(
|
|
||||||
std::unique_ptr<VideoDecoderFactory> factory)
|
|
||||||
: factory_(std::move(factory)) {}
|
|
||||||
|
|
||||||
std::vector<SdpVideoFormat> MultiplexDecoderFactory::GetSupportedFormats()
|
|
||||||
const {
|
|
||||||
std::vector<SdpVideoFormat> formats = factory_->GetSupportedFormats();
|
|
||||||
for (const auto& format : formats) {
|
|
||||||
if (cricket::CodecNamesEq(format.name, kMultiplexAssociatedCodecName)) {
|
|
||||||
SdpVideoFormat multiplex_format = format;
|
|
||||||
multiplex_format.parameters[cricket::kCodecParamAssociatedCodecName] =
|
|
||||||
format.name;
|
|
||||||
multiplex_format.name = cricket::kMultiplexCodecName;
|
|
||||||
formats.push_back(multiplex_format);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return formats;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<VideoDecoder> MultiplexDecoderFactory::CreateVideoDecoder(
|
|
||||||
const SdpVideoFormat& format) {
|
|
||||||
if (!IsMultiplexCodec(cricket::VideoCodec(format)))
|
|
||||||
return factory_->CreateVideoDecoder(format);
|
|
||||||
const auto& it =
|
|
||||||
format.parameters.find(cricket::kCodecParamAssociatedCodecName);
|
|
||||||
if (it == format.parameters.end()) {
|
|
||||||
RTC_LOG(LS_ERROR) << "No assicated codec for multiplex.";
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
SdpVideoFormat associated_format = format;
|
|
||||||
associated_format.name = it->second;
|
|
||||||
return std::unique_ptr<VideoDecoder>(
|
|
||||||
new MultiplexDecoderAdapter(factory_.get(), associated_format));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
111
media/engine/stereocodecfactory.cc
Normal file
111
media/engine/stereocodecfactory.cc
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "media/engine/stereocodecfactory.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "api/video_codecs/sdp_video_format.h"
|
||||||
|
#include "media/base/codec.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 "rtc_base/logging.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool IsStereoCodec(const cricket::VideoCodec& codec) {
|
||||||
|
return cricket::CodecNamesEq(codec.name.c_str(), cricket::kStereoCodecName);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
constexpr const char* kStereoAssociatedCodecName = cricket::kVp9CodecName;
|
||||||
|
|
||||||
|
StereoEncoderFactory::StereoEncoderFactory(
|
||||||
|
std::unique_ptr<VideoEncoderFactory> factory)
|
||||||
|
: factory_(std::move(factory)) {}
|
||||||
|
|
||||||
|
std::vector<SdpVideoFormat> StereoEncoderFactory::GetSupportedFormats() const {
|
||||||
|
std::vector<SdpVideoFormat> formats = factory_->GetSupportedFormats();
|
||||||
|
for (const auto& format : formats) {
|
||||||
|
if (cricket::CodecNamesEq(format.name, kStereoAssociatedCodecName)) {
|
||||||
|
SdpVideoFormat stereo_format = format;
|
||||||
|
stereo_format.parameters[cricket::kCodecParamAssociatedCodecName] =
|
||||||
|
format.name;
|
||||||
|
stereo_format.name = cricket::kStereoCodecName;
|
||||||
|
formats.push_back(stereo_format);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoEncoderFactory::CodecInfo StereoEncoderFactory::QueryVideoEncoder(
|
||||||
|
const SdpVideoFormat& format) const {
|
||||||
|
if (!IsStereoCodec(cricket::VideoCodec(format)))
|
||||||
|
return factory_->QueryVideoEncoder(format);
|
||||||
|
return factory_->QueryVideoEncoder(
|
||||||
|
SdpVideoFormat(kStereoAssociatedCodecName));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<VideoEncoder> StereoEncoderFactory::CreateVideoEncoder(
|
||||||
|
const SdpVideoFormat& format) {
|
||||||
|
if (!IsStereoCodec(cricket::VideoCodec(format)))
|
||||||
|
return factory_->CreateVideoEncoder(format);
|
||||||
|
const auto& it =
|
||||||
|
format.parameters.find(cricket::kCodecParamAssociatedCodecName);
|
||||||
|
if (it == format.parameters.end()) {
|
||||||
|
RTC_LOG(LS_ERROR) << "No assicated codec for stereo.";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
SdpVideoFormat associated_format = format;
|
||||||
|
associated_format.name = it->second;
|
||||||
|
return std::unique_ptr<VideoEncoder>(
|
||||||
|
new StereoEncoderAdapter(factory_.get(), associated_format));
|
||||||
|
}
|
||||||
|
|
||||||
|
StereoDecoderFactory::StereoDecoderFactory(
|
||||||
|
std::unique_ptr<VideoDecoderFactory> factory)
|
||||||
|
: factory_(std::move(factory)) {}
|
||||||
|
|
||||||
|
std::vector<SdpVideoFormat> StereoDecoderFactory::GetSupportedFormats() const {
|
||||||
|
std::vector<SdpVideoFormat> formats = factory_->GetSupportedFormats();
|
||||||
|
for (const auto& format : formats) {
|
||||||
|
if (cricket::CodecNamesEq(format.name, kStereoAssociatedCodecName)) {
|
||||||
|
SdpVideoFormat stereo_format = format;
|
||||||
|
stereo_format.parameters[cricket::kCodecParamAssociatedCodecName] =
|
||||||
|
format.name;
|
||||||
|
stereo_format.name = cricket::kStereoCodecName;
|
||||||
|
formats.push_back(stereo_format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<VideoDecoder> StereoDecoderFactory::CreateVideoDecoder(
|
||||||
|
const SdpVideoFormat& format) {
|
||||||
|
if (!IsStereoCodec(cricket::VideoCodec(format)))
|
||||||
|
return factory_->CreateVideoDecoder(format);
|
||||||
|
const auto& it =
|
||||||
|
format.parameters.find(cricket::kCodecParamAssociatedCodecName);
|
||||||
|
if (it == format.parameters.end()) {
|
||||||
|
RTC_LOG(LS_ERROR) << "No assicated codec for stereo.";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
SdpVideoFormat associated_format = format;
|
||||||
|
associated_format.name = it->second;
|
||||||
|
return std::unique_ptr<VideoDecoder>(
|
||||||
|
new StereoDecoderAdapter(factory_.get(), associated_format));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace webrtc
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_
|
#ifndef MEDIA_ENGINE_STEREOCODECFACTORY_H_
|
||||||
#define MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_
|
#define MEDIA_ENGINE_STEREOCODECFACTORY_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -19,10 +19,9 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class MultiplexEncoderFactory : public VideoEncoderFactory {
|
class StereoEncoderFactory : public VideoEncoderFactory {
|
||||||
public:
|
public:
|
||||||
explicit MultiplexEncoderFactory(
|
explicit StereoEncoderFactory(std::unique_ptr<VideoEncoderFactory> factory);
|
||||||
std::unique_ptr<VideoEncoderFactory> factory);
|
|
||||||
|
|
||||||
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
|
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
|
||||||
CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override;
|
CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override;
|
||||||
@ -33,10 +32,9 @@ class MultiplexEncoderFactory : public VideoEncoderFactory {
|
|||||||
std::unique_ptr<VideoEncoderFactory> factory_;
|
std::unique_ptr<VideoEncoderFactory> factory_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MultiplexDecoderFactory : public VideoDecoderFactory {
|
class StereoDecoderFactory : public VideoDecoderFactory {
|
||||||
public:
|
public:
|
||||||
explicit MultiplexDecoderFactory(
|
explicit StereoDecoderFactory(std::unique_ptr<VideoDecoderFactory> factory);
|
||||||
std::unique_ptr<VideoDecoderFactory> factory);
|
|
||||||
|
|
||||||
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
|
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
|
||||||
std::unique_ptr<VideoDecoder> CreateVideoDecoder(
|
std::unique_ptr<VideoDecoder> CreateVideoDecoder(
|
||||||
@ -48,4 +46,4 @@ class MultiplexDecoderFactory : public VideoDecoderFactory {
|
|||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_
|
#endif // MEDIA_ENGINE_STEREOCODECFACTORY_H_
|
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "media/engine/multiplexcodecfactory.h"
|
#include "media/engine/stereocodecfactory.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -22,24 +22,24 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
TEST(MultiplexDecoderFactory, CreateVideoDecoder) {
|
TEST(StereoDecoderFactory, CreateVideoDecoder) {
|
||||||
std::unique_ptr<VideoDecoderFactory> internal_factory(
|
std::unique_ptr<VideoDecoderFactory> internal_factory(
|
||||||
new InternalDecoderFactory());
|
new InternalDecoderFactory());
|
||||||
MultiplexDecoderFactory factory(std::move(internal_factory));
|
StereoDecoderFactory factory(std::move(internal_factory));
|
||||||
std::unique_ptr<VideoDecoder> decoder =
|
std::unique_ptr<VideoDecoder> decoder =
|
||||||
factory.CreateVideoDecoder(SdpVideoFormat(
|
factory.CreateVideoDecoder(SdpVideoFormat(
|
||||||
cricket::kMultiplexCodecName,
|
cricket::kStereoCodecName,
|
||||||
{{cricket::kCodecParamAssociatedCodecName, cricket::kVp9CodecName}}));
|
{{cricket::kCodecParamAssociatedCodecName, cricket::kVp9CodecName}}));
|
||||||
EXPECT_TRUE(decoder);
|
EXPECT_TRUE(decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MultiplexEncoderFactory, CreateVideoEncoder) {
|
TEST(StereoEncoderFactory, CreateVideoEncoder) {
|
||||||
std::unique_ptr<VideoEncoderFactory> internal_factory(
|
std::unique_ptr<VideoEncoderFactory> internal_factory(
|
||||||
new InternalEncoderFactory());
|
new InternalEncoderFactory());
|
||||||
MultiplexEncoderFactory factory(std::move(internal_factory));
|
StereoEncoderFactory factory(std::move(internal_factory));
|
||||||
std::unique_ptr<VideoEncoder> encoder =
|
std::unique_ptr<VideoEncoder> encoder =
|
||||||
factory.CreateVideoEncoder(SdpVideoFormat(
|
factory.CreateVideoEncoder(SdpVideoFormat(
|
||||||
cricket::kMultiplexCodecName,
|
cricket::kStereoCodecName,
|
||||||
{{cricket::kCodecParamAssociatedCodecName, cricket::kVp9CodecName}}));
|
{{cricket::kCodecParamAssociatedCodecName, cricket::kVp9CodecName}}));
|
||||||
EXPECT_TRUE(encoder);
|
EXPECT_TRUE(encoder);
|
||||||
}
|
}
|
@ -61,7 +61,7 @@ RtpVideoCodecTypes ConvertToRtpVideoCodecType(VideoCodecType type) {
|
|||||||
case kVideoCodecI420:
|
case kVideoCodecI420:
|
||||||
case kVideoCodecFlexfec:
|
case kVideoCodecFlexfec:
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecStereo:
|
||||||
case kVideoCodecUnknown:
|
case kVideoCodecUnknown:
|
||||||
return kRtpVideoGeneric;
|
return kRtpVideoGeneric;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ rtc_static_library("video_coding") {
|
|||||||
":video_coding_utility",
|
":video_coding_utility",
|
||||||
":webrtc_h264",
|
":webrtc_h264",
|
||||||
":webrtc_i420",
|
":webrtc_i420",
|
||||||
":webrtc_multiplex",
|
":webrtc_stereo",
|
||||||
":webrtc_vp8",
|
":webrtc_vp8",
|
||||||
":webrtc_vp8_helpers",
|
":webrtc_vp8_helpers",
|
||||||
":webrtc_vp9",
|
":webrtc_vp9",
|
||||||
@ -289,14 +289,14 @@ rtc_static_library("webrtc_i420") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_static_library("webrtc_multiplex") {
|
rtc_static_library("webrtc_stereo") {
|
||||||
sources = [
|
sources = [
|
||||||
"codecs/multiplex/include/multiplex_decoder_adapter.h",
|
"codecs/stereo/include/multiplex_encoded_image_packer.h",
|
||||||
"codecs/multiplex/include/multiplex_encoded_image_packer.h",
|
"codecs/stereo/include/stereo_decoder_adapter.h",
|
||||||
"codecs/multiplex/include/multiplex_encoder_adapter.h",
|
"codecs/stereo/include/stereo_encoder_adapter.h",
|
||||||
"codecs/multiplex/multiplex_decoder_adapter.cc",
|
"codecs/stereo/multiplex_encoded_image_packer.cc",
|
||||||
"codecs/multiplex/multiplex_encoded_image_packer.cc",
|
"codecs/stereo/stereo_decoder_adapter.cc",
|
||||||
"codecs/multiplex/multiplex_encoder_adapter.cc",
|
"codecs/stereo/stereo_encoder_adapter.cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
@ -545,7 +545,7 @@ if (rtc_include_tests) {
|
|||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"codecs/h264/test/h264_impl_unittest.cc",
|
"codecs/h264/test/h264_impl_unittest.cc",
|
||||||
"codecs/multiplex/test/multiplex_adapter_unittest.cc",
|
"codecs/stereo/test/stereo_adapter_unittest.cc",
|
||||||
"codecs/test/videoprocessor_integrationtest.cc",
|
"codecs/test/videoprocessor_integrationtest.cc",
|
||||||
"codecs/test/videoprocessor_integrationtest.h",
|
"codecs/test/videoprocessor_integrationtest.h",
|
||||||
"codecs/test/videoprocessor_integrationtest_libvpx.cc",
|
"codecs/test/videoprocessor_integrationtest_libvpx.cc",
|
||||||
@ -561,7 +561,7 @@ if (rtc_include_tests) {
|
|||||||
":video_coding",
|
":video_coding",
|
||||||
":video_coding_utility",
|
":video_coding_utility",
|
||||||
":webrtc_h264",
|
":webrtc_h264",
|
||||||
":webrtc_multiplex",
|
":webrtc_stereo",
|
||||||
":webrtc_vp8",
|
":webrtc_vp8",
|
||||||
":webrtc_vp8_helpers",
|
":webrtc_vp8_helpers",
|
||||||
":webrtc_vp9",
|
":webrtc_vp9",
|
||||||
|
@ -254,7 +254,7 @@ bool VCMCodecDataBase::RequiresEncoderReset(const VideoCodec& new_send_codec) {
|
|||||||
case kVideoCodecRED:
|
case kVideoCodecRED:
|
||||||
case kVideoCodecULPFEC:
|
case kVideoCodecULPFEC:
|
||||||
case kVideoCodecFlexfec:
|
case kVideoCodecFlexfec:
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecStereo:
|
||||||
break;
|
break;
|
||||||
// Unknown codec type, reset just to be sure.
|
// Unknown codec type, reset just to be sure.
|
||||||
case kVideoCodecUnknown:
|
case kVideoCodecUnknown:
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
#ifndef MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
||||||
#define MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
#define MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -103,4 +103,4 @@ class MultiplexEncodedImagePacker {
|
|||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
#endif // MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_MULTIPLEX_ENCODED_IMAGE_PACKER_H_
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_DECODER_ADAPTER_H_
|
#ifndef MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_DECODER_ADAPTER_H_
|
||||||
#define MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_DECODER_ADAPTER_H_
|
#define MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_DECODER_ADAPTER_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -18,16 +18,16 @@
|
|||||||
#include "api/video_codecs/sdp_video_format.h"
|
#include "api/video_codecs/sdp_video_format.h"
|
||||||
#include "api/video_codecs/video_decoder.h"
|
#include "api/video_codecs/video_decoder.h"
|
||||||
#include "api/video_codecs/video_decoder_factory.h"
|
#include "api/video_codecs/video_decoder_factory.h"
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class MultiplexDecoderAdapter : public VideoDecoder {
|
class StereoDecoderAdapter : public VideoDecoder {
|
||||||
public:
|
public:
|
||||||
// |factory| is not owned and expected to outlive this class' lifetime.
|
// |factory| is not owned and expected to outlive this class' lifetime.
|
||||||
explicit MultiplexDecoderAdapter(VideoDecoderFactory* factory,
|
explicit StereoDecoderAdapter(VideoDecoderFactory* factory,
|
||||||
const SdpVideoFormat& associated_format);
|
const SdpVideoFormat& associated_format);
|
||||||
virtual ~MultiplexDecoderAdapter();
|
virtual ~StereoDecoderAdapter();
|
||||||
|
|
||||||
// Implements VideoDecoder
|
// Implements VideoDecoder
|
||||||
int32_t InitDecode(const VideoCodec* codec_settings,
|
int32_t InitDecode(const VideoCodec* codec_settings,
|
||||||
@ -56,9 +56,9 @@ class MultiplexDecoderAdapter : public VideoDecoder {
|
|||||||
void MergeAlphaImages(VideoFrame* decoded_image,
|
void MergeAlphaImages(VideoFrame* decoded_image,
|
||||||
const rtc::Optional<int32_t>& decode_time_ms,
|
const rtc::Optional<int32_t>& decode_time_ms,
|
||||||
const rtc::Optional<uint8_t>& qp,
|
const rtc::Optional<uint8_t>& qp,
|
||||||
VideoFrame* multiplex_decoded_image,
|
VideoFrame* stereo_decoded_image,
|
||||||
const rtc::Optional<int32_t>& multiplex_decode_time_ms,
|
const rtc::Optional<int32_t>& stereo_decode_time_ms,
|
||||||
const rtc::Optional<uint8_t>& multiplex_qp);
|
const rtc::Optional<uint8_t>& stereo_qp);
|
||||||
|
|
||||||
VideoDecoderFactory* const factory_;
|
VideoDecoderFactory* const factory_;
|
||||||
const SdpVideoFormat associated_format_;
|
const SdpVideoFormat associated_format_;
|
||||||
@ -72,4 +72,4 @@ class MultiplexDecoderAdapter : public VideoDecoder {
|
|||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_DECODER_ADAPTER_H_
|
#endif // MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_DECODER_ADAPTER_H_
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODER_ADAPTER_H_
|
#ifndef MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_ENCODER_ADAPTER_H_
|
||||||
#define MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODER_ADAPTER_H_
|
#define MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_ENCODER_ADAPTER_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include "api/video_codecs/sdp_video_format.h"
|
#include "api/video_codecs/sdp_video_format.h"
|
||||||
#include "api/video_codecs/video_encoder.h"
|
#include "api/video_codecs/video_encoder.h"
|
||||||
#include "api/video_codecs/video_encoder_factory.h"
|
#include "api/video_codecs/video_encoder_factory.h"
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoded_image_packer.h"
|
#include "modules/video_coding/codecs/stereo/include/multiplex_encoded_image_packer.h"
|
||||||
#include "modules/video_coding/include/video_codec_interface.h"
|
#include "modules/video_coding/include/video_codec_interface.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -29,12 +29,12 @@ enum AlphaCodecStream {
|
|||||||
kAlphaCodecStreams = 2,
|
kAlphaCodecStreams = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MultiplexEncoderAdapter : public VideoEncoder {
|
class StereoEncoderAdapter : public VideoEncoder {
|
||||||
public:
|
public:
|
||||||
// |factory| is not owned and expected to outlive this class' lifetime.
|
// |factory| is not owned and expected to outlive this class' lifetime.
|
||||||
explicit MultiplexEncoderAdapter(VideoEncoderFactory* factory,
|
explicit StereoEncoderAdapter(VideoEncoderFactory* factory,
|
||||||
const SdpVideoFormat& associated_format);
|
const SdpVideoFormat& associated_format);
|
||||||
virtual ~MultiplexEncoderAdapter();
|
virtual ~StereoEncoderAdapter();
|
||||||
|
|
||||||
// Implements VideoEncoder
|
// Implements VideoEncoder
|
||||||
int InitEncode(const VideoCodec* inst,
|
int InitEncode(const VideoCodec* inst,
|
||||||
@ -69,7 +69,7 @@ class MultiplexEncoderAdapter : public VideoEncoder {
|
|||||||
std::map<uint32_t /* timestamp */, MultiplexImage> stashed_images_;
|
std::map<uint32_t /* timestamp */, MultiplexImage> stashed_images_;
|
||||||
|
|
||||||
uint16_t picture_index_ = 0;
|
uint16_t picture_index_ = 0;
|
||||||
std::vector<uint8_t> multiplex_dummy_planes_;
|
std::vector<uint8_t> stereo_dummy_planes_;
|
||||||
|
|
||||||
int key_frame_interval_;
|
int key_frame_interval_;
|
||||||
EncodedImage combined_image_;
|
EncodedImage combined_image_;
|
||||||
@ -77,4 +77,4 @@ class MultiplexEncoderAdapter : public VideoEncoder {
|
|||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_MULTIPLEX_ENCODER_ADAPTER_H_
|
#endif // MODULES_VIDEO_CODING_CODECS_STEREO_INCLUDE_STEREO_ENCODER_ADAPTER_H_
|
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoded_image_packer.h"
|
#include "modules/video_coding/codecs/stereo/include/multiplex_encoded_image_packer.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h"
|
#include "modules/video_coding/codecs/stereo/include/stereo_decoder_adapter.h"
|
||||||
|
|
||||||
#include "api/video/i420_buffer.h"
|
#include "api/video/i420_buffer.h"
|
||||||
#include "api/video/video_frame_buffer.h"
|
#include "api/video/video_frame_buffer.h"
|
||||||
@ -25,10 +25,10 @@ void KeepBufferRefs(rtc::scoped_refptr<webrtc::VideoFrameBuffer>,
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class MultiplexDecoderAdapter::AdapterDecodedImageCallback
|
class StereoDecoderAdapter::AdapterDecodedImageCallback
|
||||||
: public webrtc::DecodedImageCallback {
|
: public webrtc::DecodedImageCallback {
|
||||||
public:
|
public:
|
||||||
AdapterDecodedImageCallback(webrtc::MultiplexDecoderAdapter* adapter,
|
AdapterDecodedImageCallback(webrtc::StereoDecoderAdapter* adapter,
|
||||||
AlphaCodecStream stream_idx)
|
AlphaCodecStream stream_idx)
|
||||||
: adapter_(adapter), stream_idx_(stream_idx) {}
|
: adapter_(adapter), stream_idx_(stream_idx) {}
|
||||||
|
|
||||||
@ -49,11 +49,11 @@ class MultiplexDecoderAdapter::AdapterDecodedImageCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MultiplexDecoderAdapter* adapter_;
|
StereoDecoderAdapter* adapter_;
|
||||||
const AlphaCodecStream stream_idx_;
|
const AlphaCodecStream stream_idx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MultiplexDecoderAdapter::DecodedImageData {
|
struct StereoDecoderAdapter::DecodedImageData {
|
||||||
explicit DecodedImageData(AlphaCodecStream stream_idx)
|
explicit DecodedImageData(AlphaCodecStream stream_idx)
|
||||||
: stream_idx_(stream_idx),
|
: stream_idx_(stream_idx),
|
||||||
decoded_image_(I420Buffer::Create(1 /* width */, 1 /* height */),
|
decoded_image_(I420Buffer::Create(1 /* width */, 1 /* height */),
|
||||||
@ -79,18 +79,18 @@ struct MultiplexDecoderAdapter::DecodedImageData {
|
|||||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DecodedImageData);
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DecodedImageData);
|
||||||
};
|
};
|
||||||
|
|
||||||
MultiplexDecoderAdapter::MultiplexDecoderAdapter(
|
StereoDecoderAdapter::StereoDecoderAdapter(
|
||||||
VideoDecoderFactory* factory,
|
VideoDecoderFactory* factory,
|
||||||
const SdpVideoFormat& associated_format)
|
const SdpVideoFormat& associated_format)
|
||||||
: factory_(factory), associated_format_(associated_format) {}
|
: factory_(factory), associated_format_(associated_format) {}
|
||||||
|
|
||||||
MultiplexDecoderAdapter::~MultiplexDecoderAdapter() {
|
StereoDecoderAdapter::~StereoDecoderAdapter() {
|
||||||
Release();
|
Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MultiplexDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
int32_t StereoDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
||||||
int32_t number_of_cores) {
|
int32_t number_of_cores) {
|
||||||
RTC_DCHECK_EQ(kVideoCodecMultiplex, codec_settings->codecType);
|
RTC_DCHECK_EQ(kVideoCodecStereo, codec_settings->codecType);
|
||||||
VideoCodec settings = *codec_settings;
|
VideoCodec settings = *codec_settings;
|
||||||
settings.codecType = PayloadStringToCodecType(associated_format_.name);
|
settings.codecType = PayloadStringToCodecType(associated_format_.name);
|
||||||
for (size_t i = 0; i < kAlphaCodecStreams; ++i) {
|
for (size_t i = 0; i < kAlphaCodecStreams; ++i) {
|
||||||
@ -100,7 +100,7 @@ int32_t MultiplexDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
|||||||
if (rv)
|
if (rv)
|
||||||
return rv;
|
return rv;
|
||||||
adapter_callbacks_.emplace_back(
|
adapter_callbacks_.emplace_back(
|
||||||
new MultiplexDecoderAdapter::AdapterDecodedImageCallback(
|
new StereoDecoderAdapter::AdapterDecodedImageCallback(
|
||||||
this, static_cast<AlphaCodecStream>(i)));
|
this, static_cast<AlphaCodecStream>(i)));
|
||||||
decoder->RegisterDecodeCompleteCallback(adapter_callbacks_.back().get());
|
decoder->RegisterDecodeCompleteCallback(adapter_callbacks_.back().get());
|
||||||
decoders_.emplace_back(std::move(decoder));
|
decoders_.emplace_back(std::move(decoder));
|
||||||
@ -108,7 +108,7 @@ int32_t MultiplexDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
|
|||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MultiplexDecoderAdapter::Decode(
|
int32_t StereoDecoderAdapter::Decode(
|
||||||
const EncodedImage& input_image,
|
const EncodedImage& input_image,
|
||||||
bool missing_frames,
|
bool missing_frames,
|
||||||
const RTPFragmentationHeader* /*fragmentation*/,
|
const RTPFragmentationHeader* /*fragmentation*/,
|
||||||
@ -135,13 +135,13 @@ int32_t MultiplexDecoderAdapter::Decode(
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MultiplexDecoderAdapter::RegisterDecodeCompleteCallback(
|
int32_t StereoDecoderAdapter::RegisterDecodeCompleteCallback(
|
||||||
DecodedImageCallback* callback) {
|
DecodedImageCallback* callback) {
|
||||||
decoded_complete_callback_ = callback;
|
decoded_complete_callback_ = callback;
|
||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MultiplexDecoderAdapter::Release() {
|
int32_t StereoDecoderAdapter::Release() {
|
||||||
for (auto& decoder : decoders_) {
|
for (auto& decoder : decoders_) {
|
||||||
const int32_t rv = decoder->Release();
|
const int32_t rv = decoder->Release();
|
||||||
if (rv)
|
if (rv)
|
||||||
@ -152,10 +152,10 @@ int32_t MultiplexDecoderAdapter::Release() {
|
|||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
void StereoDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
||||||
VideoFrame* decoded_image,
|
VideoFrame* decoded_image,
|
||||||
rtc::Optional<int32_t> decode_time_ms,
|
rtc::Optional<int32_t> decode_time_ms,
|
||||||
rtc::Optional<uint8_t> qp) {
|
rtc::Optional<uint8_t> qp) {
|
||||||
const auto& other_decoded_data_it =
|
const auto& other_decoded_data_it =
|
||||||
decoded_data_.find(decoded_image->timestamp());
|
decoded_data_.find(decoded_image->timestamp());
|
||||||
if (other_decoded_data_it != decoded_data_.end()) {
|
if (other_decoded_data_it != decoded_data_.end()) {
|
||||||
@ -183,7 +183,7 @@ void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
|||||||
std::forward_as_tuple(stream_idx, *decoded_image, decode_time_ms, qp));
|
std::forward_as_tuple(stream_idx, *decoded_image, decode_time_ms, qp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplexDecoderAdapter::MergeAlphaImages(
|
void StereoDecoderAdapter::MergeAlphaImages(
|
||||||
VideoFrame* decoded_image,
|
VideoFrame* decoded_image,
|
||||||
const rtc::Optional<int32_t>& decode_time_ms,
|
const rtc::Optional<int32_t>& decode_time_ms,
|
||||||
const rtc::Optional<uint8_t>& qp,
|
const rtc::Optional<uint8_t>& qp,
|
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -23,10 +23,10 @@ namespace webrtc {
|
|||||||
|
|
||||||
// Callback wrapper that helps distinguish returned results from |encoders_|
|
// Callback wrapper that helps distinguish returned results from |encoders_|
|
||||||
// instances.
|
// instances.
|
||||||
class MultiplexEncoderAdapter::AdapterEncodedImageCallback
|
class StereoEncoderAdapter::AdapterEncodedImageCallback
|
||||||
: public webrtc::EncodedImageCallback {
|
: public webrtc::EncodedImageCallback {
|
||||||
public:
|
public:
|
||||||
AdapterEncodedImageCallback(webrtc::MultiplexEncoderAdapter* adapter,
|
AdapterEncodedImageCallback(webrtc::StereoEncoderAdapter* adapter,
|
||||||
AlphaCodecStream stream_idx)
|
AlphaCodecStream stream_idx)
|
||||||
: adapter_(adapter), stream_idx_(stream_idx) {}
|
: adapter_(adapter), stream_idx_(stream_idx) {}
|
||||||
|
|
||||||
@ -41,32 +41,31 @@ class MultiplexEncoderAdapter::AdapterEncodedImageCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MultiplexEncoderAdapter* adapter_;
|
StereoEncoderAdapter* adapter_;
|
||||||
const AlphaCodecStream stream_idx_;
|
const AlphaCodecStream stream_idx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
MultiplexEncoderAdapter::MultiplexEncoderAdapter(
|
StereoEncoderAdapter::StereoEncoderAdapter(
|
||||||
VideoEncoderFactory* factory,
|
VideoEncoderFactory* factory,
|
||||||
const SdpVideoFormat& associated_format)
|
const SdpVideoFormat& associated_format)
|
||||||
: factory_(factory),
|
: factory_(factory),
|
||||||
associated_format_(associated_format),
|
associated_format_(associated_format),
|
||||||
encoded_complete_callback_(nullptr) {}
|
encoded_complete_callback_(nullptr) {}
|
||||||
|
|
||||||
MultiplexEncoderAdapter::~MultiplexEncoderAdapter() {
|
StereoEncoderAdapter::~StereoEncoderAdapter() {
|
||||||
Release();
|
Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MultiplexEncoderAdapter::InitEncode(const VideoCodec* inst,
|
int StereoEncoderAdapter::InitEncode(const VideoCodec* inst,
|
||||||
int number_of_cores,
|
int number_of_cores,
|
||||||
size_t max_payload_size) {
|
size_t max_payload_size) {
|
||||||
const size_t buffer_size =
|
const size_t buffer_size =
|
||||||
CalcBufferSize(VideoType::kI420, inst->width, inst->height);
|
CalcBufferSize(VideoType::kI420, inst->width, inst->height);
|
||||||
multiplex_dummy_planes_.resize(buffer_size);
|
stereo_dummy_planes_.resize(buffer_size);
|
||||||
// It is more expensive to encode 0x00, so use 0x80 instead.
|
// It is more expensive to encode 0x00, so use 0x80 instead.
|
||||||
std::fill(multiplex_dummy_planes_.begin(), multiplex_dummy_planes_.end(),
|
std::fill(stereo_dummy_planes_.begin(), stereo_dummy_planes_.end(), 0x80);
|
||||||
0x80);
|
|
||||||
|
|
||||||
RTC_DCHECK_EQ(kVideoCodecMultiplex, inst->codecType);
|
RTC_DCHECK_EQ(kVideoCodecStereo, inst->codecType);
|
||||||
VideoCodec settings = *inst;
|
VideoCodec settings = *inst;
|
||||||
settings.codecType = PayloadStringToCodecType(associated_format_.name);
|
settings.codecType = PayloadStringToCodecType(associated_format_.name);
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ int MultiplexEncoderAdapter::InitEncode(const VideoCodec* inst,
|
|||||||
const int rv =
|
const int rv =
|
||||||
encoder->InitEncode(&settings, number_of_cores, max_payload_size);
|
encoder->InitEncode(&settings, number_of_cores, max_payload_size);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
RTC_LOG(LS_ERROR) << "Failed to create multiplex codec index " << i;
|
RTC_LOG(LS_ERROR) << "Failed to create stereo codec index " << i;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
adapter_callbacks_.emplace_back(new AdapterEncodedImageCallback(
|
adapter_callbacks_.emplace_back(new AdapterEncodedImageCallback(
|
||||||
@ -106,10 +105,9 @@ int MultiplexEncoderAdapter::InitEncode(const VideoCodec* inst,
|
|||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MultiplexEncoderAdapter::Encode(
|
int StereoEncoderAdapter::Encode(const VideoFrame& input_image,
|
||||||
const VideoFrame& input_image,
|
const CodecSpecificInfo* codec_specific_info,
|
||||||
const CodecSpecificInfo* codec_specific_info,
|
const std::vector<FrameType>* frame_types) {
|
||||||
const std::vector<FrameType>* frame_types) {
|
|
||||||
if (!encoded_complete_callback_) {
|
if (!encoded_complete_callback_) {
|
||||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||||
}
|
}
|
||||||
@ -144,8 +142,8 @@ int MultiplexEncoderAdapter::Encode(
|
|||||||
rtc::scoped_refptr<I420BufferInterface> alpha_buffer =
|
rtc::scoped_refptr<I420BufferInterface> alpha_buffer =
|
||||||
WrapI420Buffer(input_image.width(), input_image.height(),
|
WrapI420Buffer(input_image.width(), input_image.height(),
|
||||||
yuva_buffer->DataA(), yuva_buffer->StrideA(),
|
yuva_buffer->DataA(), yuva_buffer->StrideA(),
|
||||||
multiplex_dummy_planes_.data(), yuva_buffer->StrideU(),
|
stereo_dummy_planes_.data(), yuva_buffer->StrideU(),
|
||||||
multiplex_dummy_planes_.data(), yuva_buffer->StrideV(),
|
stereo_dummy_planes_.data(), yuva_buffer->StrideV(),
|
||||||
rtc::KeepRefUntilDone(input_image.video_frame_buffer()));
|
rtc::KeepRefUntilDone(input_image.video_frame_buffer()));
|
||||||
VideoFrame alpha_image(alpha_buffer, input_image.timestamp(),
|
VideoFrame alpha_image(alpha_buffer, input_image.timestamp(),
|
||||||
input_image.render_time_ms(), input_image.rotation());
|
input_image.render_time_ms(), input_image.rotation());
|
||||||
@ -154,14 +152,14 @@ int MultiplexEncoderAdapter::Encode(
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MultiplexEncoderAdapter::RegisterEncodeCompleteCallback(
|
int StereoEncoderAdapter::RegisterEncodeCompleteCallback(
|
||||||
EncodedImageCallback* callback) {
|
EncodedImageCallback* callback) {
|
||||||
encoded_complete_callback_ = callback;
|
encoded_complete_callback_ = callback;
|
||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MultiplexEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
int StereoEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
||||||
int64_t rtt) {
|
int64_t rtt) {
|
||||||
for (auto& encoder : encoders_) {
|
for (auto& encoder : encoders_) {
|
||||||
const int rv = encoder->SetChannelParameters(packet_loss, rtt);
|
const int rv = encoder->SetChannelParameters(packet_loss, rtt);
|
||||||
if (rv)
|
if (rv)
|
||||||
@ -170,8 +168,8 @@ int MultiplexEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
|||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MultiplexEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
|
int StereoEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
|
||||||
uint32_t framerate) {
|
uint32_t framerate) {
|
||||||
for (auto& encoder : encoders_) {
|
for (auto& encoder : encoders_) {
|
||||||
// TODO(emircan): |framerate| is used to calculate duration in encoder
|
// TODO(emircan): |framerate| is used to calculate duration in encoder
|
||||||
// instances. We report the total frame rate to keep real time for now.
|
// instances. We report the total frame rate to keep real time for now.
|
||||||
@ -184,7 +182,7 @@ int MultiplexEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
|
|||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MultiplexEncoderAdapter::Release() {
|
int StereoEncoderAdapter::Release() {
|
||||||
for (auto& encoder : encoders_) {
|
for (auto& encoder : encoders_) {
|
||||||
const int rv = encoder->Release();
|
const int rv = encoder->Release();
|
||||||
if (rv)
|
if (rv)
|
||||||
@ -205,11 +203,11 @@ int MultiplexEncoderAdapter::Release() {
|
|||||||
return WEBRTC_VIDEO_CODEC_OK;
|
return WEBRTC_VIDEO_CODEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* MultiplexEncoderAdapter::ImplementationName() const {
|
const char* StereoEncoderAdapter::ImplementationName() const {
|
||||||
return "MultiplexEncoderAdapter";
|
return "StereoEncoderAdapter";
|
||||||
}
|
}
|
||||||
|
|
||||||
EncodedImageCallback::Result MultiplexEncoderAdapter::OnEncodedImage(
|
EncodedImageCallback::Result StereoEncoderAdapter::OnEncodedImage(
|
||||||
AlphaCodecStream stream_idx,
|
AlphaCodecStream stream_idx,
|
||||||
const EncodedImage& encodedImage,
|
const EncodedImage& encodedImage,
|
||||||
const CodecSpecificInfo* codecSpecificInfo,
|
const CodecSpecificInfo* codecSpecificInfo,
|
||||||
@ -248,7 +246,7 @@ EncodedImageCallback::Result MultiplexEncoderAdapter::OnEncodedImage(
|
|||||||
MultiplexEncodedImagePacker::PackAndRelease(iter->second);
|
MultiplexEncodedImagePacker::PackAndRelease(iter->second);
|
||||||
|
|
||||||
CodecSpecificInfo codec_info = *codecSpecificInfo;
|
CodecSpecificInfo codec_info = *codecSpecificInfo;
|
||||||
codec_info.codecType = kVideoCodecMultiplex;
|
codec_info.codecType = kVideoCodecStereo;
|
||||||
codec_info.codecSpecific.generic.simulcast_idx = 0;
|
codec_info.codecSpecific.generic.simulcast_idx = 0;
|
||||||
encoded_complete_callback_->OnEncodedImage(combined_image_, &codec_info,
|
encoded_complete_callback_->OnEncodedImage(combined_image_, &codec_info,
|
||||||
fragmentation);
|
fragmentation);
|
@ -14,8 +14,8 @@
|
|||||||
#include "common_video/include/video_frame_buffer.h"
|
#include "common_video/include/video_frame_buffer.h"
|
||||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||||
#include "media/base/mediaconstants.h"
|
#include "media/base/mediaconstants.h"
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h"
|
#include "modules/video_coding/codecs/stereo/include/stereo_decoder_adapter.h"
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
#include "modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h"
|
||||||
#include "modules/video_coding/codecs/test/video_codec_test.h"
|
#include "modules/video_coding/codecs/test/video_codec_test.h"
|
||||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||||
#include "rtc_base/keep_ref_until_done.h"
|
#include "rtc_base/keep_ref_until_done.h"
|
||||||
@ -26,33 +26,33 @@ using testing::Return;
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
constexpr const char* kMultiplexAssociatedCodecName = cricket::kVp9CodecName;
|
constexpr const char* kStereoAssociatedCodecName = cricket::kVp9CodecName;
|
||||||
const VideoCodecType kMultiplexAssociatedCodecType =
|
const VideoCodecType kStereoAssociatedCodecType =
|
||||||
PayloadStringToCodecType(kMultiplexAssociatedCodecName);
|
PayloadStringToCodecType(kStereoAssociatedCodecName);
|
||||||
|
|
||||||
class TestMultiplexAdapter : public VideoCodecTest {
|
class TestStereoAdapter : public VideoCodecTest {
|
||||||
public:
|
public:
|
||||||
TestMultiplexAdapter()
|
TestStereoAdapter()
|
||||||
: decoder_factory_(new webrtc::MockVideoDecoderFactory),
|
: decoder_factory_(new webrtc::MockVideoDecoderFactory),
|
||||||
encoder_factory_(new webrtc::MockVideoEncoderFactory) {}
|
encoder_factory_(new webrtc::MockVideoEncoderFactory) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<VideoDecoder> CreateDecoder() override {
|
std::unique_ptr<VideoDecoder> CreateDecoder() override {
|
||||||
return rtc::MakeUnique<MultiplexDecoderAdapter>(
|
return rtc::MakeUnique<StereoDecoderAdapter>(
|
||||||
decoder_factory_.get(), SdpVideoFormat(kMultiplexAssociatedCodecName));
|
decoder_factory_.get(), SdpVideoFormat(kStereoAssociatedCodecName));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<VideoEncoder> CreateEncoder() override {
|
std::unique_ptr<VideoEncoder> CreateEncoder() override {
|
||||||
return rtc::MakeUnique<MultiplexEncoderAdapter>(
|
return rtc::MakeUnique<StereoEncoderAdapter>(
|
||||||
encoder_factory_.get(), SdpVideoFormat(kMultiplexAssociatedCodecName));
|
encoder_factory_.get(), SdpVideoFormat(kStereoAssociatedCodecName));
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCodec codec_settings() override {
|
VideoCodec codec_settings() override {
|
||||||
VideoCodec codec_settings;
|
VideoCodec codec_settings;
|
||||||
codec_settings.codecType = kMultiplexAssociatedCodecType;
|
codec_settings.codecType = kStereoAssociatedCodecType;
|
||||||
codec_settings.VP9()->numberOfTemporalLayers = 1;
|
codec_settings.VP9()->numberOfTemporalLayers = 1;
|
||||||
codec_settings.VP9()->numberOfSpatialLayers = 1;
|
codec_settings.VP9()->numberOfSpatialLayers = 1;
|
||||||
codec_settings.codecType = webrtc::kVideoCodecMultiplex;
|
codec_settings.codecType = webrtc::kVideoCodecStereo;
|
||||||
return codec_settings;
|
return codec_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,22 +96,22 @@ class TestMultiplexAdapter : public VideoCodecTest {
|
|||||||
// TODO(emircan): Currently VideoCodecTest tests do a complete setup
|
// TODO(emircan): Currently VideoCodecTest tests do a complete setup
|
||||||
// step that goes beyond constructing |decoder_|. Simplify these tests to do
|
// step that goes beyond constructing |decoder_|. Simplify these tests to do
|
||||||
// less.
|
// less.
|
||||||
TEST_F(TestMultiplexAdapter, ConstructAndDestructDecoder) {
|
TEST_F(TestStereoAdapter, ConstructAndDestructDecoder) {
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release());
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestMultiplexAdapter, ConstructAndDestructEncoder) {
|
TEST_F(TestStereoAdapter, ConstructAndDestructEncoder) {
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release());
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestMultiplexAdapter, EncodeDecodeI420Frame) {
|
TEST_F(TestStereoAdapter, EncodeDecodeI420Frame) {
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||||
encoder_->Encode(*input_frame_, nullptr, nullptr));
|
encoder_->Encode(*input_frame_, nullptr, nullptr));
|
||||||
EncodedImage encoded_frame;
|
EncodedImage encoded_frame;
|
||||||
CodecSpecificInfo codec_specific_info;
|
CodecSpecificInfo codec_specific_info;
|
||||||
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
||||||
|
|
||||||
EXPECT_EQ(kVideoCodecMultiplex, codec_specific_info.codecType);
|
EXPECT_EQ(kVideoCodecStereo, codec_specific_info.codecType);
|
||||||
|
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
WEBRTC_VIDEO_CODEC_OK,
|
WEBRTC_VIDEO_CODEC_OK,
|
||||||
@ -123,7 +123,7 @@ TEST_F(TestMultiplexAdapter, EncodeDecodeI420Frame) {
|
|||||||
EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36);
|
EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestMultiplexAdapter, EncodeDecodeI420AFrame) {
|
TEST_F(TestStereoAdapter, EncodeDecodeI420AFrame) {
|
||||||
std::unique_ptr<VideoFrame> yuva_frame = CreateI420AInputFrame();
|
std::unique_ptr<VideoFrame> yuva_frame = CreateI420AInputFrame();
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||||
encoder_->Encode(*yuva_frame, nullptr, nullptr));
|
encoder_->Encode(*yuva_frame, nullptr, nullptr));
|
||||||
@ -131,7 +131,7 @@ TEST_F(TestMultiplexAdapter, EncodeDecodeI420AFrame) {
|
|||||||
CodecSpecificInfo codec_specific_info;
|
CodecSpecificInfo codec_specific_info;
|
||||||
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
||||||
|
|
||||||
EXPECT_EQ(kVideoCodecMultiplex, codec_specific_info.codecType);
|
EXPECT_EQ(kVideoCodecStereo, codec_specific_info.codecType);
|
||||||
|
|
||||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||||
decoder_->Decode(encoded_frame, false, nullptr, nullptr));
|
decoder_->Decode(encoded_frame, false, nullptr, nullptr));
|
@ -98,7 +98,7 @@ RtpFrameReferenceFinder::ManageFrameInternal(RtpFrameObject* frame) {
|
|||||||
case kVideoCodecUnknown:
|
case kVideoCodecUnknown:
|
||||||
case kVideoCodecH264:
|
case kVideoCodecH264:
|
||||||
case kVideoCodecI420:
|
case kVideoCodecI420:
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecStereo:
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
return ManageFrameGeneric(frame, kNoPictureId);
|
return ManageFrameGeneric(frame, kNoPictureId);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ bool VideoCodecInitializer::SetupCodec(
|
|||||||
bool nack_enabled,
|
bool nack_enabled,
|
||||||
VideoCodec* codec,
|
VideoCodec* codec,
|
||||||
std::unique_ptr<VideoBitrateAllocator>* bitrate_allocator) {
|
std::unique_ptr<VideoBitrateAllocator>* bitrate_allocator) {
|
||||||
if (PayloadStringToCodecType(settings.payload_name) == kVideoCodecMultiplex) {
|
if (PayloadStringToCodecType(settings.payload_name) == kVideoCodecStereo) {
|
||||||
VideoSendStream::Config::EncoderSettings associated_codec_settings =
|
VideoSendStream::Config::EncoderSettings associated_codec_settings =
|
||||||
settings;
|
settings;
|
||||||
associated_codec_settings.payload_name =
|
associated_codec_settings.payload_name =
|
||||||
@ -49,7 +49,7 @@ bool VideoCodecInitializer::SetupCodec(
|
|||||||
RTC_LOG(LS_ERROR) << "Failed to create stereo encoder configuration.";
|
RTC_LOG(LS_ERROR) << "Failed to create stereo encoder configuration.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
codec->codecType = kVideoCodecMultiplex;
|
codec->codecType = kVideoCodecStereo;
|
||||||
strncpy(codec->plName, settings.payload_name.c_str(),
|
strncpy(codec->plName, settings.payload_name.c_str(),
|
||||||
sizeof(codec->plName));
|
sizeof(codec->plName));
|
||||||
return true;
|
return true;
|
||||||
|
@ -79,7 +79,7 @@ class VideoCodecInitializerTest : public ::testing::Test {
|
|||||||
webrtc::VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings);
|
webrtc::VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings);
|
||||||
settings_.payload_name = kVp8PayloadName;
|
settings_.payload_name = kVp8PayloadName;
|
||||||
settings_.payload_type = kVp8PayloadType;
|
settings_.payload_type = kVp8PayloadType;
|
||||||
} else if (type == VideoCodecType::kVideoCodecMultiplex) {
|
} else if (type == VideoCodecType::kVideoCodecStereo) {
|
||||||
} else {
|
} else {
|
||||||
ADD_FAILURE() << "Unexpected codec type: " << type;
|
ADD_FAILURE() << "Unexpected codec type: " << type;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ class VideoCodecInitializerTest : public ::testing::Test {
|
|||||||
&bitrate_allocator_out_)) {
|
&bitrate_allocator_out_)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (codec_out_.codecType == VideoCodecType::kVideoCodecMultiplex)
|
if (codec_out_.codecType == VideoCodecType::kVideoCodecStereo)
|
||||||
return true;
|
return true;
|
||||||
// Make sure temporal layers instances have been created.
|
// Make sure temporal layers instances have been created.
|
||||||
if (codec_out_.codecType == VideoCodecType::kVideoCodecVP8) {
|
if (codec_out_.codecType == VideoCodecType::kVideoCodecVP8) {
|
||||||
@ -257,8 +257,8 @@ TEST_F(VideoCodecInitializerTest, HighFpsSimulcastVp8Screenshare) {
|
|||||||
bitrate_allocation.GetBitrate(1, 1));
|
bitrate_allocation.GetBitrate(1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoCodecInitializerTest, SingleStreamMultiplexCodec) {
|
TEST_F(VideoCodecInitializerTest, SingleStreamStereoCodec) {
|
||||||
SetUpFor(VideoCodecType::kVideoCodecMultiplex, 1, 1, true);
|
SetUpFor(VideoCodecType::kVideoCodecStereo, 1, 1, true);
|
||||||
streams_.push_back(DefaultStream());
|
streams_.push_back(DefaultStream());
|
||||||
EXPECT_TRUE(InitializeCodec());
|
EXPECT_TRUE(InitializeCodec());
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ static void CodecSettings(VideoCodecType codec_type, VideoCodec* settings) {
|
|||||||
case kVideoCodecRED:
|
case kVideoCodecRED:
|
||||||
case kVideoCodecULPFEC:
|
case kVideoCodecULPFEC:
|
||||||
case kVideoCodecFlexfec:
|
case kVideoCodecFlexfec:
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecStereo:
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
case kVideoCodecUnknown:
|
case kVideoCodecUnknown:
|
||||||
RTC_NOTREACHED();
|
RTC_NOTREACHED();
|
||||||
|
@ -81,7 +81,7 @@ void CopyCodecSpecific(const CodecSpecificInfo* info, RTPVideoHeader* rtp) {
|
|||||||
rtp->codecHeader.H264.packetization_mode =
|
rtp->codecHeader.H264.packetization_mode =
|
||||||
info->codecSpecific.H264.packetization_mode;
|
info->codecSpecific.H264.packetization_mode;
|
||||||
return;
|
return;
|
||||||
case kVideoCodecMultiplex:
|
case kVideoCodecStereo:
|
||||||
case kVideoCodecGeneric:
|
case kVideoCodecGeneric:
|
||||||
rtp->codec = kRtpVideoGeneric;
|
rtp->codec = kRtpVideoGeneric;
|
||||||
rtp->simulcastIdx = info->codecSpecific.generic.simulcast_idx;
|
rtp->simulcastIdx = info->codecSpecific.generic.simulcast_idx;
|
||||||
|
@ -60,11 +60,11 @@ VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) {
|
|||||||
*(codec.H264()) = VideoEncoder::GetDefaultH264Settings();
|
*(codec.H264()) = VideoEncoder::GetDefaultH264Settings();
|
||||||
codec.H264()->profile =
|
codec.H264()->profile =
|
||||||
H264::ParseSdpProfileLevelId(decoder.codec_params)->profile;
|
H264::ParseSdpProfileLevelId(decoder.codec_params)->profile;
|
||||||
} else if (codec.codecType == kVideoCodecMultiplex) {
|
} else if (codec.codecType == kVideoCodecStereo) {
|
||||||
VideoReceiveStream::Decoder associated_decoder = decoder;
|
VideoReceiveStream::Decoder associated_decoder = decoder;
|
||||||
associated_decoder.payload_name = CodecTypeToPayloadString(kVideoCodecVP9);
|
associated_decoder.payload_name = CodecTypeToPayloadString(kVideoCodecVP9);
|
||||||
VideoCodec associated_codec = CreateDecoderVideoCodec(associated_decoder);
|
VideoCodec associated_codec = CreateDecoderVideoCodec(associated_decoder);
|
||||||
associated_codec.codecType = kVideoCodecMultiplex;
|
associated_codec.codecType = kVideoCodecStereo;
|
||||||
strncpy(associated_codec.plName, decoder.payload_name.c_str(),
|
strncpy(associated_codec.plName, decoder.payload_name.c_str(),
|
||||||
sizeof(associated_codec.plName));
|
sizeof(associated_codec.plName));
|
||||||
return associated_codec;
|
return associated_codec;
|
||||||
|
Reference in New Issue
Block a user