Revert "Add multiplex case to webrtc_perf_tests"
This reverts commit d90a7e842437f5760a34bbfa283b3c4182963889. Reason for revert: Fails on Win ASan bots. https://logs.chromium.org/v/?s=chromium%2Fbb%2Fclient.webrtc%2FWin32_ASan%2F4002%2F%2B%2Frecipes%2Fsteps%2Fvideo_engine_tests%2F0%2Fstdout Original change's description: > Add multiplex case to webrtc_perf_tests > > This CL adds two new tests to perf, covering I420 and I420A input to multiplex > codec. In order to have the correct input, it adds I420A case to > SquareGenerator and corresponding PSNR and SSIM calculations. > > Bug: webrtc:7671 > Change-Id: I9735d725bbfba457e804e29907cee55406ae5c8d > Reviewed-on: https://webrtc-review.googlesource.com/52180 > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org> > Reviewed-by: Erik Språng <sprang@webrtc.org> > Commit-Queue: Emircan Uysaler <emircan@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22330} TBR=phoglund@webrtc.org,sprang@webrtc.org,niklas.enbom@webrtc.org,qiangchen@chromium.org,emircan@webrtc.org Change-Id: If6bfdd42556517db0dd6bda01f5d3d901ff56b0c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7671 Reviewed-on: https://webrtc-review.googlesource.com/60560 Reviewed-by: Emircan Uysaler <emircan@webrtc.org> Commit-Queue: Emircan Uysaler <emircan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22332}
This commit is contained in:
parent
a06e919b9f
commit
5aac372db9
@ -172,8 +172,8 @@ class BitrateEstimatorTest : public test::CallTest {
|
|||||||
test_->video_encoder_config_.Copy());
|
test_->video_encoder_config_.Copy());
|
||||||
RTC_DCHECK_EQ(1, test_->video_encoder_config_.number_of_streams);
|
RTC_DCHECK_EQ(1, test_->video_encoder_config_.number_of_streams);
|
||||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
||||||
kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt,
|
kDefaultWidth, kDefaultHeight, kDefaultFramerate,
|
||||||
kDefaultFramerate, Clock::GetRealTimeClock()));
|
Clock::GetRealTimeClock()));
|
||||||
send_stream_->SetSource(
|
send_stream_->SetSource(
|
||||||
frame_generator_capturer_.get(),
|
frame_generator_capturer_.get(),
|
||||||
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||||
|
|||||||
@ -13,8 +13,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "api/video/i420_buffer.h"
|
#include "api/video/i420_buffer.h"
|
||||||
#include "common_video/include/video_frame_buffer.h"
|
|
||||||
#include "rtc_base/bind.h"
|
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "third_party/libyuv/include/libyuv.h"
|
#include "third_party/libyuv/include/libyuv.h"
|
||||||
|
|
||||||
@ -205,78 +203,6 @@ int ConvertFromI420(const VideoFrame& src_frame,
|
|||||||
ConvertVideoType(dst_video_type));
|
ConvertVideoType(dst_video_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions for keeping references alive.
|
|
||||||
void KeepBufferRefs(rtc::scoped_refptr<webrtc::VideoFrameBuffer>,
|
|
||||||
rtc::scoped_refptr<webrtc::VideoFrameBuffer>) {}
|
|
||||||
|
|
||||||
rtc::scoped_refptr<I420ABufferInterface> ScaleI420ABuffer(
|
|
||||||
const I420ABufferInterface& buffer,
|
|
||||||
int target_width,
|
|
||||||
int target_height) {
|
|
||||||
rtc::scoped_refptr<I420Buffer> yuv_buffer =
|
|
||||||
I420Buffer::Create(target_width, target_height);
|
|
||||||
yuv_buffer->ScaleFrom(buffer);
|
|
||||||
rtc::scoped_refptr<I420Buffer> axx_buffer =
|
|
||||||
I420Buffer::Create(target_width, target_height);
|
|
||||||
libyuv::ScalePlane(buffer.DataA(), buffer.StrideA(), buffer.width(),
|
|
||||||
buffer.height(), axx_buffer->MutableDataY(),
|
|
||||||
axx_buffer->StrideY(), target_width, target_height,
|
|
||||||
libyuv::kFilterBox);
|
|
||||||
rtc::scoped_refptr<I420ABufferInterface> merged_buffer = WrapI420ABuffer(
|
|
||||||
yuv_buffer->width(), yuv_buffer->height(), yuv_buffer->DataY(),
|
|
||||||
yuv_buffer->StrideY(), yuv_buffer->DataU(), yuv_buffer->StrideU(),
|
|
||||||
yuv_buffer->DataV(), yuv_buffer->StrideV(), axx_buffer->DataY(),
|
|
||||||
axx_buffer->StrideY(),
|
|
||||||
rtc::Bind(&KeepBufferRefs, yuv_buffer, axx_buffer));
|
|
||||||
return merged_buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute PSNR for an I420A frame (all planes). Can upscale test frame.
|
|
||||||
double I420APSNR(const I420ABufferInterface& ref_buffer,
|
|
||||||
const I420ABufferInterface& test_buffer) {
|
|
||||||
RTC_DCHECK_GE(ref_buffer.width(), test_buffer.width());
|
|
||||||
RTC_DCHECK_GE(ref_buffer.height(), test_buffer.height());
|
|
||||||
if ((ref_buffer.width() != test_buffer.width()) ||
|
|
||||||
(ref_buffer.height() != test_buffer.height())) {
|
|
||||||
rtc::scoped_refptr<I420ABufferInterface> scaled_buffer =
|
|
||||||
ScaleI420ABuffer(test_buffer, ref_buffer.width(), ref_buffer.height());
|
|
||||||
return I420APSNR(ref_buffer, *scaled_buffer);
|
|
||||||
}
|
|
||||||
const int width = test_buffer.width();
|
|
||||||
const int height = test_buffer.height();
|
|
||||||
const uint64_t sse_y = libyuv::ComputeSumSquareErrorPlane(
|
|
||||||
ref_buffer.DataY(), ref_buffer.StrideY(), test_buffer.DataY(),
|
|
||||||
test_buffer.StrideY(), width, height);
|
|
||||||
const int width_uv = (width + 1) >> 1;
|
|
||||||
const int height_uv = (height + 1) >> 1;
|
|
||||||
const uint64_t sse_u = libyuv::ComputeSumSquareErrorPlane(
|
|
||||||
ref_buffer.DataU(), ref_buffer.StrideU(), test_buffer.DataU(),
|
|
||||||
test_buffer.StrideU(), width_uv, height_uv);
|
|
||||||
const uint64_t sse_v = libyuv::ComputeSumSquareErrorPlane(
|
|
||||||
ref_buffer.DataV(), ref_buffer.StrideV(), test_buffer.DataV(),
|
|
||||||
test_buffer.StrideV(), width_uv, height_uv);
|
|
||||||
const uint64_t sse_a = libyuv::ComputeSumSquareErrorPlane(
|
|
||||||
ref_buffer.DataA(), ref_buffer.StrideA(), test_buffer.DataA(),
|
|
||||||
test_buffer.StrideA(), width, height);
|
|
||||||
const uint64_t samples = 2 * (uint64_t)width * (uint64_t)height +
|
|
||||||
2 * ((uint64_t)width_uv * (uint64_t)height_uv);
|
|
||||||
const uint64_t sse = sse_y + sse_u + sse_v + sse_a;
|
|
||||||
const double psnr = libyuv::SumSquareErrorToPsnr(sse, samples);
|
|
||||||
return (psnr > kPerfectPSNR) ? kPerfectPSNR : psnr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute PSNR for an I420A frame (all planes)
|
|
||||||
double I420APSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame) {
|
|
||||||
if (!ref_frame || !test_frame)
|
|
||||||
return -1;
|
|
||||||
RTC_DCHECK(ref_frame->video_frame_buffer()->type() ==
|
|
||||||
VideoFrameBuffer::Type::kI420A);
|
|
||||||
RTC_DCHECK(test_frame->video_frame_buffer()->type() ==
|
|
||||||
VideoFrameBuffer::Type::kI420A);
|
|
||||||
return I420APSNR(*ref_frame->video_frame_buffer()->GetI420A(),
|
|
||||||
*test_frame->video_frame_buffer()->GetI420A());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute PSNR for an I420 frame (all planes). Can upscale test frame.
|
// Compute PSNR for an I420 frame (all planes). Can upscale test frame.
|
||||||
double I420PSNR(const I420BufferInterface& ref_buffer,
|
double I420PSNR(const I420BufferInterface& ref_buffer,
|
||||||
const I420BufferInterface& test_buffer) {
|
const I420BufferInterface& test_buffer) {
|
||||||
@ -308,41 +234,6 @@ double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame) {
|
|||||||
*test_frame->video_frame_buffer()->ToI420());
|
*test_frame->video_frame_buffer()->ToI420());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute SSIM for an I420A frame (all planes). Can upscale test frame.
|
|
||||||
double I420ASSIM(const I420ABufferInterface& ref_buffer,
|
|
||||||
const I420ABufferInterface& test_buffer) {
|
|
||||||
RTC_DCHECK_GE(ref_buffer.width(), test_buffer.width());
|
|
||||||
RTC_DCHECK_GE(ref_buffer.height(), test_buffer.height());
|
|
||||||
if ((ref_buffer.width() != test_buffer.width()) ||
|
|
||||||
(ref_buffer.height() != test_buffer.height())) {
|
|
||||||
rtc::scoped_refptr<I420ABufferInterface> scaled_buffer =
|
|
||||||
ScaleI420ABuffer(test_buffer, ref_buffer.width(), ref_buffer.height());
|
|
||||||
return I420ASSIM(ref_buffer, *scaled_buffer);
|
|
||||||
}
|
|
||||||
const double yuv_ssim = libyuv::I420Ssim(
|
|
||||||
ref_buffer.DataY(), ref_buffer.StrideY(), ref_buffer.DataU(),
|
|
||||||
ref_buffer.StrideU(), ref_buffer.DataV(), ref_buffer.StrideV(),
|
|
||||||
test_buffer.DataY(), test_buffer.StrideY(), test_buffer.DataU(),
|
|
||||||
test_buffer.StrideU(), test_buffer.DataV(), test_buffer.StrideV(),
|
|
||||||
test_buffer.width(), test_buffer.height());
|
|
||||||
const double a_ssim = libyuv::CalcFrameSsim(
|
|
||||||
ref_buffer.DataA(), ref_buffer.StrideA(), test_buffer.DataA(),
|
|
||||||
test_buffer.StrideA(), test_buffer.width(), test_buffer.height());
|
|
||||||
return (yuv_ssim + (a_ssim * 0.8)) / 1.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute SSIM for an I420A frame (all planes)
|
|
||||||
double I420ASSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame) {
|
|
||||||
if (!ref_frame || !test_frame)
|
|
||||||
return -1;
|
|
||||||
RTC_DCHECK(ref_frame->video_frame_buffer()->type() ==
|
|
||||||
VideoFrameBuffer::Type::kI420A);
|
|
||||||
RTC_DCHECK(test_frame->video_frame_buffer()->type() ==
|
|
||||||
VideoFrameBuffer::Type::kI420A);
|
|
||||||
return I420ASSIM(*ref_frame->video_frame_buffer()->GetI420A(),
|
|
||||||
*test_frame->video_frame_buffer()->GetI420A());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute SSIM for an I420 frame (all planes). Can upscale test_buffer.
|
// Compute SSIM for an I420 frame (all planes). Can upscale test_buffer.
|
||||||
double I420SSIM(const I420BufferInterface& ref_buffer,
|
double I420SSIM(const I420BufferInterface& ref_buffer,
|
||||||
const I420BufferInterface& test_buffer) {
|
const I420BufferInterface& test_buffer) {
|
||||||
@ -362,7 +253,6 @@ double I420SSIM(const I420BufferInterface& ref_buffer,
|
|||||||
test_buffer.StrideU(), test_buffer.DataV(), test_buffer.StrideV(),
|
test_buffer.StrideU(), test_buffer.DataV(), test_buffer.StrideV(),
|
||||||
test_buffer.width(), test_buffer.height());
|
test_buffer.width(), test_buffer.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame) {
|
double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame) {
|
||||||
if (!ref_frame || !test_frame)
|
if (!ref_frame || !test_frame)
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -613,7 +613,6 @@ rtc_source_set("test_common") {
|
|||||||
"../common_video",
|
"../common_video",
|
||||||
"../logging:rtc_event_log_api",
|
"../logging:rtc_event_log_api",
|
||||||
"../logging:rtc_event_log_impl_base",
|
"../logging:rtc_event_log_impl_base",
|
||||||
"../media:rtc_internal_video_codecs",
|
|
||||||
"../media:rtc_media_base",
|
"../media:rtc_media_base",
|
||||||
"../modules/audio_device:mock_audio_device",
|
"../modules/audio_device:mock_audio_device",
|
||||||
"../modules/audio_mixer:audio_mixer_impl",
|
"../modules/audio_mixer:audio_mixer_impl",
|
||||||
@ -624,7 +623,6 @@ rtc_source_set("test_common") {
|
|||||||
"../modules/video_coding:video_codec_interface",
|
"../modules/video_coding:video_codec_interface",
|
||||||
"../modules/video_coding:video_coding_utility",
|
"../modules/video_coding:video_coding_utility",
|
||||||
"../modules/video_coding:webrtc_h264",
|
"../modules/video_coding:webrtc_h264",
|
||||||
"../modules/video_coding:webrtc_multiplex",
|
|
||||||
"../modules/video_coding:webrtc_vp8",
|
"../modules/video_coding:webrtc_vp8",
|
||||||
"../modules/video_coding:webrtc_vp9",
|
"../modules/video_coding:webrtc_vp9",
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
|
|||||||
@ -6,7 +6,6 @@ include_rules = [
|
|||||||
"+common_video",
|
"+common_video",
|
||||||
"+logging/rtc_event_log",
|
"+logging/rtc_event_log",
|
||||||
"+media/base",
|
"+media/base",
|
||||||
"+media/engine",
|
|
||||||
"+modules/audio_coding",
|
"+modules/audio_coding",
|
||||||
"+modules/audio_device",
|
"+modules/audio_device",
|
||||||
"+modules/audio_mixer",
|
"+modules/audio_mixer",
|
||||||
|
|||||||
@ -316,7 +316,7 @@ void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock,
|
|||||||
int width,
|
int width,
|
||||||
int height) {
|
int height) {
|
||||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
||||||
width, height, rtc::nullopt, rtc::nullopt, framerate * speed, clock));
|
width, height, framerate * speed, clock));
|
||||||
video_send_stream_->SetSource(
|
video_send_stream_->SetSource(
|
||||||
frame_generator_capturer_.get(),
|
frame_generator_capturer_.get(),
|
||||||
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||||
@ -325,8 +325,8 @@ void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock,
|
|||||||
void CallTest::CreateFrameGeneratorCapturer(int framerate,
|
void CallTest::CreateFrameGeneratorCapturer(int framerate,
|
||||||
int width,
|
int width,
|
||||||
int height) {
|
int height) {
|
||||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
frame_generator_capturer_.reset(
|
||||||
width, height, rtc::nullopt, rtc::nullopt, framerate, clock_));
|
test::FrameGeneratorCapturer::Create(width, height, framerate, clock_));
|
||||||
video_send_stream_->SetSource(
|
video_send_stream_->SetSource(
|
||||||
frame_generator_capturer_.get(),
|
frame_generator_capturer_.get(),
|
||||||
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||||
|
|||||||
@ -12,9 +12,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "media/engine/internaldecoderfactory.h"
|
|
||||||
#include "modules/video_coding/codecs/h264/include/h264.h"
|
#include "modules/video_coding/codecs/h264/include/h264.h"
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h"
|
|
||||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||||
#include "rtc_base/refcountedobject.h"
|
#include "rtc_base/refcountedobject.h"
|
||||||
@ -104,9 +102,6 @@ VideoReceiveStream::Decoder CreateMatchingDecoder(
|
|||||||
decoder.decoder = VP8Decoder::Create().release();
|
decoder.decoder = VP8Decoder::Create().release();
|
||||||
} else if (encoder_settings.payload_name == "VP9") {
|
} else if (encoder_settings.payload_name == "VP9") {
|
||||||
decoder.decoder = VP9Decoder::Create().release();
|
decoder.decoder = VP9Decoder::Create().release();
|
||||||
} else if (encoder_settings.payload_name == "multiplex") {
|
|
||||||
decoder.decoder = new MultiplexDecoderAdapter(
|
|
||||||
new InternalDecoderFactory(), SdpVideoFormat(cricket::kVp9CodecName));
|
|
||||||
} else {
|
} else {
|
||||||
decoder.decoder = new FakeDecoder();
|
decoder.decoder = new FakeDecoder();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,17 +28,12 @@ namespace webrtc {
|
|||||||
namespace test {
|
namespace test {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Helper method for keeping a reference to passed pointers.
|
|
||||||
void KeepBufferRefs(rtc::scoped_refptr<webrtc::VideoFrameBuffer>,
|
|
||||||
rtc::scoped_refptr<webrtc::VideoFrameBuffer>) {}
|
|
||||||
|
|
||||||
// SquareGenerator is a FrameGenerator that draws a given amount of randomly
|
// SquareGenerator is a FrameGenerator that draws a given amount of randomly
|
||||||
// sized and colored squares. Between each new generated frame, the squares
|
// sized and colored squares. Between each new generated frame, the squares
|
||||||
// are moved slightly towards the lower right corner.
|
// are moved slightly towards the lower right corner.
|
||||||
class SquareGenerator : public FrameGenerator {
|
class SquareGenerator : public FrameGenerator {
|
||||||
public:
|
public:
|
||||||
SquareGenerator(int width, int height, OutputType type, int num_squares)
|
SquareGenerator(int width, int height, int num_squares) {
|
||||||
: type_(type) {
|
|
||||||
ChangeResolution(width, height);
|
ChangeResolution(width, height);
|
||||||
for (int i = 0; i < num_squares; ++i) {
|
for (int i = 0; i < num_squares; ++i) {
|
||||||
squares_.emplace_back(new Square(width, height, i + 1));
|
squares_.emplace_back(new Square(width, height, i + 1));
|
||||||
@ -53,39 +48,16 @@ class SquareGenerator : public FrameGenerator {
|
|||||||
RTC_CHECK(height_ > 0);
|
RTC_CHECK(height_ > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::scoped_refptr<I420Buffer> CreateI420Buffer(int width, int height) {
|
VideoFrame* NextFrame() override {
|
||||||
rtc::scoped_refptr<I420Buffer> buffer(I420Buffer::Create(width, height));
|
rtc::CritScope lock(&crit_);
|
||||||
memset(buffer->MutableDataY(), 127, height * buffer->StrideY());
|
|
||||||
|
rtc::scoped_refptr<I420Buffer> buffer(I420Buffer::Create(width_, height_));
|
||||||
|
|
||||||
|
memset(buffer->MutableDataY(), 127, height_ * buffer->StrideY());
|
||||||
memset(buffer->MutableDataU(), 127,
|
memset(buffer->MutableDataU(), 127,
|
||||||
buffer->ChromaHeight() * buffer->StrideU());
|
buffer->ChromaHeight() * buffer->StrideU());
|
||||||
memset(buffer->MutableDataV(), 127,
|
memset(buffer->MutableDataV(), 127,
|
||||||
buffer->ChromaHeight() * buffer->StrideV());
|
buffer->ChromaHeight() * buffer->StrideV());
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoFrame* NextFrame() override {
|
|
||||||
rtc::CritScope lock(&crit_);
|
|
||||||
|
|
||||||
rtc::scoped_refptr<VideoFrameBuffer> buffer = nullptr;
|
|
||||||
switch (type_) {
|
|
||||||
case OutputType::I420: {
|
|
||||||
buffer = CreateI420Buffer(width_, height_);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case OutputType::I420A: {
|
|
||||||
rtc::scoped_refptr<I420Buffer> yuv_buffer =
|
|
||||||
CreateI420Buffer(width_, height_);
|
|
||||||
rtc::scoped_refptr<I420Buffer> axx_buffer =
|
|
||||||
CreateI420Buffer(width_, height_);
|
|
||||||
buffer = WrapI420ABuffer(
|
|
||||||
yuv_buffer->width(), yuv_buffer->height(), yuv_buffer->DataY(),
|
|
||||||
yuv_buffer->StrideY(), yuv_buffer->DataU(), yuv_buffer->StrideU(),
|
|
||||||
yuv_buffer->DataV(), yuv_buffer->StrideV(), axx_buffer->DataY(),
|
|
||||||
axx_buffer->StrideY(),
|
|
||||||
rtc::Bind(&KeepBufferRefs, yuv_buffer, axx_buffer));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& square : squares_)
|
for (const auto& square : squares_)
|
||||||
square->Draw(buffer);
|
square->Draw(buffer);
|
||||||
@ -104,41 +76,25 @@ class SquareGenerator : public FrameGenerator {
|
|||||||
length_(random_generator_.Rand(1, width > 4 ? width / 4 : 1)),
|
length_(random_generator_.Rand(1, width > 4 ? width / 4 : 1)),
|
||||||
yuv_y_(random_generator_.Rand(0, 255)),
|
yuv_y_(random_generator_.Rand(0, 255)),
|
||||||
yuv_u_(random_generator_.Rand(0, 255)),
|
yuv_u_(random_generator_.Rand(0, 255)),
|
||||||
yuv_v_(random_generator_.Rand(0, 255)),
|
yuv_v_(random_generator_.Rand(0, 255)) {}
|
||||||
yuv_a_(random_generator_.Rand(0, 255)) {}
|
|
||||||
|
|
||||||
void Draw(const rtc::scoped_refptr<VideoFrameBuffer>& frame_buffer) {
|
void Draw(const rtc::scoped_refptr<I420Buffer>& buffer) {
|
||||||
RTC_DCHECK(frame_buffer->type() == VideoFrameBuffer::Type::kI420 ||
|
|
||||||
frame_buffer->type() == VideoFrameBuffer::Type::kI420A);
|
|
||||||
rtc::scoped_refptr<I420BufferInterface> buffer = frame_buffer->ToI420();
|
|
||||||
x_ = (x_ + random_generator_.Rand(0, 4)) % (buffer->width() - length_);
|
x_ = (x_ + random_generator_.Rand(0, 4)) % (buffer->width() - length_);
|
||||||
y_ = (y_ + random_generator_.Rand(0, 4)) % (buffer->height() - length_);
|
y_ = (y_ + random_generator_.Rand(0, 4)) % (buffer->height() - length_);
|
||||||
for (int y = y_; y < y_ + length_; ++y) {
|
for (int y = y_; y < y_ + length_; ++y) {
|
||||||
uint8_t* pos_y = (const_cast<uint8_t*>(buffer->DataY()) + x_ +
|
uint8_t* pos_y =
|
||||||
y * buffer->StrideY());
|
(buffer->MutableDataY() + x_ + y * buffer->StrideY());
|
||||||
memset(pos_y, yuv_y_, length_);
|
memset(pos_y, yuv_y_, length_);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = y_; y < y_ + length_; y = y + 2) {
|
for (int y = y_; y < y_ + length_; y = y + 2) {
|
||||||
uint8_t* pos_u = (const_cast<uint8_t*>(buffer->DataU()) + x_ / 2 +
|
uint8_t* pos_u =
|
||||||
y / 2 * buffer->StrideU());
|
(buffer->MutableDataU() + x_ / 2 + y / 2 * buffer->StrideU());
|
||||||
memset(pos_u, yuv_u_, length_ / 2);
|
memset(pos_u, yuv_u_, length_ / 2);
|
||||||
uint8_t* pos_v = (const_cast<uint8_t*>(buffer->DataV()) + x_ / 2 +
|
uint8_t* pos_v =
|
||||||
y / 2 * buffer->StrideV());
|
(buffer->MutableDataV() + x_ / 2 + y / 2 * buffer->StrideV());
|
||||||
memset(pos_v, yuv_v_, length_ / 2);
|
memset(pos_v, yuv_v_, length_ / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame_buffer->type() == VideoFrameBuffer::Type::kI420)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Optionally draw on alpha plane if given.
|
|
||||||
const webrtc::I420ABufferInterface* yuva_buffer =
|
|
||||||
frame_buffer->GetI420A();
|
|
||||||
for (int y = y_; y < y_ + length_; ++y) {
|
|
||||||
uint8_t* pos_y = (const_cast<uint8_t*>(yuva_buffer->DataA()) + x_ +
|
|
||||||
y * yuva_buffer->StrideA());
|
|
||||||
memset(pos_y, yuv_a_, length_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -149,11 +105,9 @@ class SquareGenerator : public FrameGenerator {
|
|||||||
const uint8_t yuv_y_;
|
const uint8_t yuv_y_;
|
||||||
const uint8_t yuv_u_;
|
const uint8_t yuv_u_;
|
||||||
const uint8_t yuv_v_;
|
const uint8_t yuv_v_;
|
||||||
const uint8_t yuv_a_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rtc::CriticalSection crit_;
|
rtc::CriticalSection crit_;
|
||||||
const OutputType type_;
|
|
||||||
int width_ RTC_GUARDED_BY(&crit_);
|
int width_ RTC_GUARDED_BY(&crit_);
|
||||||
int height_ RTC_GUARDED_BY(&crit_);
|
int height_ RTC_GUARDED_BY(&crit_);
|
||||||
std::vector<std::unique_ptr<Square>> squares_ RTC_GUARDED_BY(&crit_);
|
std::vector<std::unique_ptr<Square>> squares_ RTC_GUARDED_BY(&crit_);
|
||||||
@ -442,12 +396,15 @@ bool FrameForwarder::has_sinks() const {
|
|||||||
|
|
||||||
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSquareGenerator(
|
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSquareGenerator(
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height) {
|
||||||
rtc::Optional<OutputType> type,
|
|
||||||
rtc::Optional<int> num_squares) {
|
|
||||||
return std::unique_ptr<FrameGenerator>(
|
return std::unique_ptr<FrameGenerator>(
|
||||||
new SquareGenerator(width, height, type.value_or(OutputType::I420),
|
new SquareGenerator(width, height, 10));
|
||||||
num_squares.value_or(10)));
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<FrameGenerator>
|
||||||
|
FrameGenerator::CreateSquareGenerator(int width, int height, int num_squares) {
|
||||||
|
return std::unique_ptr<FrameGenerator>(
|
||||||
|
new SquareGenerator(width, height, num_squares));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSlideGenerator(
|
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSlideGenerator(
|
||||||
|
|||||||
@ -58,14 +58,13 @@ class FrameGenerator {
|
|||||||
RTC_NOTREACHED();
|
RTC_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class OutputType { I420, I420A };
|
|
||||||
// Creates a frame generator that produces frames with small squares that
|
// Creates a frame generator that produces frames with small squares that
|
||||||
// move randomly towards the lower right corner.
|
// move randomly towards the lower right corner.
|
||||||
static std::unique_ptr<FrameGenerator> CreateSquareGenerator(
|
static std::unique_ptr<FrameGenerator> CreateSquareGenerator(int width,
|
||||||
int width,
|
int height);
|
||||||
int height,
|
static std::unique_ptr<FrameGenerator> CreateSquareGenerator(int width,
|
||||||
rtc::Optional<OutputType> type,
|
int height,
|
||||||
rtc::Optional<int> num_squares);
|
int num_squares);
|
||||||
|
|
||||||
// Creates a frame generator that repeatedly plays a set of yuv files.
|
// Creates a frame generator that repeatedly plays a set of yuv files.
|
||||||
// The frame_repeat_count determines how many times each frame is shown,
|
// The frame_repeat_count determines how many times each frame is shown,
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#include "rtc_base/task_queue.h"
|
#include "rtc_base/task_queue.h"
|
||||||
#include "rtc_base/timeutils.h"
|
#include "rtc_base/timeutils.h"
|
||||||
#include "system_wrappers/include/clock.h"
|
#include "system_wrappers/include/clock.h"
|
||||||
|
#include "test/frame_generator.h"
|
||||||
#include "call/video_send_stream.h"
|
#include "call/video_send_stream.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -84,16 +85,25 @@ class FrameGeneratorCapturer::InsertFrameTask : public rtc::QueuedTask {
|
|||||||
int64_t intended_run_time_ms_;
|
int64_t intended_run_time_ms_;
|
||||||
};
|
};
|
||||||
|
|
||||||
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(
|
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(int width,
|
||||||
int width,
|
int height,
|
||||||
int height,
|
int target_fps,
|
||||||
rtc::Optional<FrameGenerator::OutputType> type,
|
Clock* clock) {
|
||||||
rtc::Optional<int> num_squares,
|
|
||||||
int target_fps,
|
|
||||||
Clock* clock) {
|
|
||||||
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
|
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
|
||||||
clock,
|
clock, FrameGenerator::CreateSquareGenerator(width, height), target_fps));
|
||||||
FrameGenerator::CreateSquareGenerator(width, height, type, num_squares),
|
if (!capturer->Init())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return capturer.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(int width,
|
||||||
|
int height,
|
||||||
|
int num_squares,
|
||||||
|
int target_fps,
|
||||||
|
Clock* clock) {
|
||||||
|
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
|
||||||
|
clock, FrameGenerator::CreateSquareGenerator(width, height, num_squares),
|
||||||
target_fps));
|
target_fps));
|
||||||
if (!capturer->Init())
|
if (!capturer->Init())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
#include "rtc_base/criticalsection.h"
|
#include "rtc_base/criticalsection.h"
|
||||||
#include "rtc_base/task_queue.h"
|
#include "rtc_base/task_queue.h"
|
||||||
#include "test/frame_generator.h"
|
|
||||||
#include "test/video_capturer.h"
|
#include "test/video_capturer.h"
|
||||||
#include "typedefs.h" // NOLINT(build/include)
|
#include "typedefs.h" // NOLINT(build/include)
|
||||||
|
|
||||||
@ -41,13 +40,16 @@ class FrameGeneratorCapturer : public VideoCapturer {
|
|||||||
virtual ~SinkWantsObserver() {}
|
virtual ~SinkWantsObserver() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
static FrameGeneratorCapturer* Create(
|
static FrameGeneratorCapturer* Create(int width,
|
||||||
int width,
|
int height,
|
||||||
int height,
|
int target_fps,
|
||||||
rtc::Optional<FrameGenerator::OutputType> type,
|
Clock* clock);
|
||||||
rtc::Optional<int> num_squares,
|
|
||||||
int target_fps,
|
static FrameGeneratorCapturer* Create(int width,
|
||||||
Clock* clock);
|
int height,
|
||||||
|
int num_squares,
|
||||||
|
int target_fps,
|
||||||
|
Clock* clock);
|
||||||
|
|
||||||
static FrameGeneratorCapturer* CreateFromYuvFile(const std::string& file_name,
|
static FrameGeneratorCapturer* CreateFromYuvFile(const std::string& file_name,
|
||||||
size_t width,
|
size_t width,
|
||||||
|
|||||||
@ -118,7 +118,6 @@ if (rtc_include_tests) {
|
|||||||
"../modules/audio_mixer:audio_mixer_impl",
|
"../modules/audio_mixer:audio_mixer_impl",
|
||||||
"../modules/rtp_rtcp",
|
"../modules/rtp_rtcp",
|
||||||
"../modules/video_coding:webrtc_h264",
|
"../modules/video_coding:webrtc_h264",
|
||||||
"../modules/video_coding:webrtc_multiplex",
|
|
||||||
"../modules/video_coding:webrtc_vp8",
|
"../modules/video_coding:webrtc_vp8",
|
||||||
"../modules/video_coding:webrtc_vp9",
|
"../modules/video_coding:webrtc_vp9",
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
|
|||||||
@ -131,8 +131,7 @@ TEST_P(CallOperationEndToEndTest, RendersSingleDelayedFrame) {
|
|||||||
// Create frames that are smaller than the send width/height, this is done
|
// Create frames that are smaller than the send width/height, this is done
|
||||||
// to check that the callbacks are done after processing video.
|
// to check that the callbacks are done after processing video.
|
||||||
std::unique_ptr<test::FrameGenerator> frame_generator(
|
std::unique_ptr<test::FrameGenerator> frame_generator(
|
||||||
test::FrameGenerator::CreateSquareGenerator(
|
test::FrameGenerator::CreateSquareGenerator(kWidth, kHeight));
|
||||||
kWidth, kHeight, rtc::nullopt, rtc::nullopt));
|
|
||||||
video_send_stream_->SetSource(
|
video_send_stream_->SetSource(
|
||||||
&frame_forwarder,
|
&frame_forwarder,
|
||||||
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||||
@ -189,7 +188,7 @@ TEST_P(CallOperationEndToEndTest, TransmitsFirstFrame) {
|
|||||||
Start();
|
Start();
|
||||||
|
|
||||||
frame_generator = test::FrameGenerator::CreateSquareGenerator(
|
frame_generator = test::FrameGenerator::CreateSquareGenerator(
|
||||||
kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
|
kDefaultWidth, kDefaultHeight);
|
||||||
video_send_stream_->SetSource(
|
video_send_stream_->SetSource(
|
||||||
&frame_forwarder,
|
&frame_forwarder,
|
||||||
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||||
@ -268,7 +267,7 @@ TEST_P(CallOperationEndToEndTest, ObserversEncodedFrames) {
|
|||||||
Start();
|
Start();
|
||||||
|
|
||||||
frame_generator = test::FrameGenerator::CreateSquareGenerator(
|
frame_generator = test::FrameGenerator::CreateSquareGenerator(
|
||||||
kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
|
kDefaultWidth, kDefaultHeight);
|
||||||
video_send_stream_->SetSource(
|
video_send_stream_->SetSource(
|
||||||
&forwarder, VideoSendStream::DegradationPreference::kMaintainFramerate);
|
&forwarder, VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||||
forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
|
forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
|
||||||
|
|||||||
@ -100,8 +100,7 @@ void MultiStreamTester::RunTest() {
|
|||||||
receive_streams[i]->Start();
|
receive_streams[i]->Start();
|
||||||
|
|
||||||
frame_generators[i] = test::FrameGeneratorCapturer::Create(
|
frame_generators[i] = test::FrameGeneratorCapturer::Create(
|
||||||
width, height, rtc::nullopt, rtc::nullopt, 30,
|
width, height, 30, Clock::GetRealTimeClock());
|
||||||
Clock::GetRealTimeClock());
|
|
||||||
send_streams[i]->SetSource(
|
send_streams[i]->SetSource(
|
||||||
frame_generators[i],
|
frame_generators[i],
|
||||||
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
VideoSendStream::DegradationPreference::kMaintainFramerate);
|
||||||
|
|||||||
@ -73,29 +73,6 @@ TEST_F(FullStackTest, ForemanCifPlr5Vp9) {
|
|||||||
foreman_cif.pipe.queue_delay_ms = 50;
|
foreman_cif.pipe.queue_delay_ms = 50;
|
||||||
RunTest(foreman_cif);
|
RunTest(foreman_cif);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FullStackTest, ForemanCifWithoutPacketLossMultiplexI420Frame) {
|
|
||||||
VideoQualityTest::Params foreman_cif;
|
|
||||||
foreman_cif.call.send_side_bwe = true;
|
|
||||||
foreman_cif.video[0] = {true, 352, 288, 30, 700000,
|
|
||||||
700000, 700000, false, "multiplex", 1,
|
|
||||||
0, 0, false, false, "foreman_cif"};
|
|
||||||
foreman_cif.analyzer = {"foreman_cif_net_delay_0_0_plr_0_Multiplex", 0.0, 0.0,
|
|
||||||
kFullStackTestDurationSecs};
|
|
||||||
RunTest(foreman_cif);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(FullStackTest, ForemanCifWithoutPacketLossMultiplexI420AFrame) {
|
|
||||||
VideoQualityTest::Params foreman_cif;
|
|
||||||
foreman_cif.call.send_side_bwe = true;
|
|
||||||
foreman_cif.video[0] = {true, 352, 288, 30, 700000,
|
|
||||||
700000, 700000, false, "multiplex", 1,
|
|
||||||
0, 0, false, false, "GeneratorI420A"};
|
|
||||||
foreman_cif.analyzer = {"foreman_cif_net_delay_0_0_plr_0_Multiplex", 0.0, 0.0,
|
|
||||||
kFullStackTestDurationSecs};
|
|
||||||
RunTest(foreman_cif);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // !defined(RTC_DISABLE_VP9)
|
#endif // !defined(RTC_DISABLE_VP9)
|
||||||
|
|
||||||
TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) {
|
TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) {
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
#include "modules/rtp_rtcp/source/rtp_format.h"
|
#include "modules/rtp_rtcp/source/rtp_format.h"
|
||||||
#include "modules/rtp_rtcp/source/rtp_utility.h"
|
#include "modules/rtp_rtcp/source/rtp_utility.h"
|
||||||
#include "modules/video_coding/codecs/h264/include/h264.h"
|
#include "modules/video_coding/codecs/h264/include/h264.h"
|
||||||
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
|
|
||||||
#include "modules/video_coding/codecs/vp8/include/vp8_common_types.h"
|
#include "modules/video_coding/codecs/vp8/include/vp8_common_types.h"
|
||||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||||
#include "rtc_base/cpu_time.h"
|
#include "rtc_base/cpu_time.h"
|
||||||
@ -1387,10 +1386,6 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
|
|||||||
} else if (params_.video[video_idx].codec == "VP9") {
|
} else if (params_.video[video_idx].codec == "VP9") {
|
||||||
video_encoders_[video_idx] = VP9Encoder::Create();
|
video_encoders_[video_idx] = VP9Encoder::Create();
|
||||||
payload_type = kPayloadTypeVP9;
|
payload_type = kPayloadTypeVP9;
|
||||||
} else if (params_.video[video_idx].codec == "multiplex") {
|
|
||||||
video_encoders_[video_idx] = rtc::MakeUnique<MultiplexEncoderAdapter>(
|
|
||||||
new InternalEncoderFactory(), SdpVideoFormat(cricket::kVp9CodecName));
|
|
||||||
payload_type = kPayloadTypeVP9;
|
|
||||||
} else {
|
} else {
|
||||||
RTC_NOTREACHED() << "Codec not supported!";
|
RTC_NOTREACHED() << "Codec not supported!";
|
||||||
return;
|
return;
|
||||||
@ -1706,7 +1701,7 @@ void VideoQualityTest::SetupThumbnailCapturers(size_t num_thumbnail_streams) {
|
|||||||
for (size_t i = 0; i < num_thumbnail_streams; ++i) {
|
for (size_t i = 0; i < num_thumbnail_streams; ++i) {
|
||||||
thumbnail_capturers_.emplace_back(test::FrameGeneratorCapturer::Create(
|
thumbnail_capturers_.emplace_back(test::FrameGeneratorCapturer::Create(
|
||||||
static_cast<int>(thumbnail.width), static_cast<int>(thumbnail.height),
|
static_cast<int>(thumbnail.width), static_cast<int>(thumbnail.height),
|
||||||
rtc::nullopt, rtc::nullopt, thumbnail.max_framerate, clock_));
|
thumbnail.max_framerate, clock_));
|
||||||
RTC_DCHECK(thumbnail_capturers_.back());
|
RTC_DCHECK(thumbnail_capturers_.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1770,15 +1765,9 @@ void VideoQualityTest::CreateCapturers() {
|
|||||||
video_capturers_[video_idx].reset(frame_generator_capturer);
|
video_capturers_[video_idx].reset(frame_generator_capturer);
|
||||||
} else {
|
} else {
|
||||||
if (params_.video[video_idx].clip_name == "Generator") {
|
if (params_.video[video_idx].clip_name == "Generator") {
|
||||||
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
|
|
||||||
static_cast<int>(params_.video[video_idx].width),
|
|
||||||
static_cast<int>(params_.video[video_idx].height), rtc::nullopt,
|
|
||||||
rtc::nullopt, params_.video[video_idx].fps, clock_));
|
|
||||||
} else if (params_.video[video_idx].clip_name == "GeneratorI420A") {
|
|
||||||
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
|
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
|
||||||
static_cast<int>(params_.video[video_idx].width),
|
static_cast<int>(params_.video[video_idx].width),
|
||||||
static_cast<int>(params_.video[video_idx].height),
|
static_cast<int>(params_.video[video_idx].height),
|
||||||
test::FrameGenerator::OutputType::I420A, rtc::nullopt,
|
|
||||||
params_.video[video_idx].fps, clock_));
|
params_.video[video_idx].fps, clock_));
|
||||||
} else if (params_.video[video_idx].clip_name.empty()) {
|
} else if (params_.video[video_idx].clip_name.empty()) {
|
||||||
video_capturers_[video_idx].reset(test::VcmCapturer::Create(
|
video_capturers_[video_idx].reset(test::VcmCapturer::Create(
|
||||||
@ -1791,8 +1780,7 @@ void VideoQualityTest::CreateCapturers() {
|
|||||||
test::FrameGeneratorCapturer::Create(
|
test::FrameGeneratorCapturer::Create(
|
||||||
static_cast<int>(params_.video[video_idx].width),
|
static_cast<int>(params_.video[video_idx].width),
|
||||||
static_cast<int>(params_.video[video_idx].height),
|
static_cast<int>(params_.video[video_idx].height),
|
||||||
rtc::nullopt, rtc::nullopt, params_.video[video_idx].fps,
|
params_.video[video_idx].fps, clock_));
|
||||||
clock_));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
video_capturers_[video_idx].reset(
|
video_capturers_[video_idx].reset(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user