Add support of displaying video during the PC level test
Bug: webrtc:10138 Change-Id: Ic74b58bc4f1be1793e0dd1a0c286f8d4200fe6f2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151901 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29111}
This commit is contained in:
@ -197,6 +197,8 @@ class PeerConnectionE2EQualityTestFixture {
|
|||||||
// output files will be appended with indexes. The produced files contains
|
// output files will be appended with indexes. The produced files contains
|
||||||
// what was rendered for this video stream on receiver side.
|
// what was rendered for this video stream on receiver side.
|
||||||
absl::optional<std::string> output_dump_file_name;
|
absl::optional<std::string> output_dump_file_name;
|
||||||
|
// If true will display input and output video on the user's screen.
|
||||||
|
bool show_on_screen = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Contains properties for audio in the call.
|
// Contains properties for audio in the call.
|
||||||
|
@ -193,6 +193,8 @@ if (rtc_include_tests) {
|
|||||||
":quality_analyzing_video_decoder",
|
":quality_analyzing_video_decoder",
|
||||||
":quality_analyzing_video_encoder",
|
":quality_analyzing_video_encoder",
|
||||||
":simulcast_dummy_buffer_helper",
|
":simulcast_dummy_buffer_helper",
|
||||||
|
"../..:test_renderer",
|
||||||
|
"../../../api:peer_connection_quality_test_fixture_api",
|
||||||
"../../../api:stats_observer_interface",
|
"../../../api:stats_observer_interface",
|
||||||
"../../../api:video_quality_analyzer_api",
|
"../../../api:video_quality_analyzer_api",
|
||||||
"../../../api/video:video_frame",
|
"../../../api/video:video_frame",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "test/pc/e2e/analyzer/video/quality_analyzing_video_decoder.h"
|
#include "test/pc/e2e/analyzer/video/quality_analyzing_video_decoder.h"
|
||||||
#include "test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.h"
|
#include "test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.h"
|
||||||
#include "test/pc/e2e/analyzer/video/simulcast_dummy_buffer_helper.h"
|
#include "test/pc/e2e/analyzer/video/simulcast_dummy_buffer_helper.h"
|
||||||
|
#include "test/video_renderer.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace webrtc_pc_e2e {
|
namespace webrtc_pc_e2e {
|
||||||
@ -58,8 +59,8 @@ class AnalyzingFrameGenerator final : public test::FrameGenerator {
|
|||||||
uint16_t frame_id = analyzer_->OnFrameCaptured(stream_label_, *frame);
|
uint16_t frame_id = analyzer_->OnFrameCaptured(stream_label_, *frame);
|
||||||
frame->set_id(frame_id);
|
frame->set_id(frame_id);
|
||||||
|
|
||||||
for (auto& listener : sinks_) {
|
for (auto& sink : sinks_) {
|
||||||
listener->OnFrame(*frame);
|
sink->OnFrame(*frame);
|
||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
@ -94,8 +95,8 @@ class AnalyzingVideoSink final : public rtc::VideoSinkInterface<VideoFrame> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
analyzer_->OnFrameRendered(frame);
|
analyzer_->OnFrameRendered(frame);
|
||||||
for (auto& listener : sinks_) {
|
for (auto& sink : sinks_) {
|
||||||
listener->OnFrame(frame);
|
sink->OnFrame(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,25 +144,36 @@ VideoQualityAnalyzerInjectionHelper::WrapVideoDecoderFactory(
|
|||||||
|
|
||||||
std::unique_ptr<test::FrameGenerator>
|
std::unique_ptr<test::FrameGenerator>
|
||||||
VideoQualityAnalyzerInjectionHelper::WrapFrameGenerator(
|
VideoQualityAnalyzerInjectionHelper::WrapFrameGenerator(
|
||||||
std::string stream_label,
|
const VideoConfig& config,
|
||||||
std::unique_ptr<test::FrameGenerator> delegate,
|
std::unique_ptr<test::FrameGenerator> delegate,
|
||||||
test::VideoFrameWriter* writer) const {
|
test::VideoFrameWriter* writer) const {
|
||||||
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>> sinks;
|
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>> sinks;
|
||||||
if (writer) {
|
if (writer) {
|
||||||
sinks.push_back(absl::make_unique<VideoWriter>(writer));
|
sinks.push_back(absl::make_unique<VideoWriter>(writer));
|
||||||
}
|
}
|
||||||
|
if (config.show_on_screen) {
|
||||||
|
sinks.push_back(absl::WrapUnique(
|
||||||
|
test::VideoRenderer::Create((*config.stream_label + "-capture").c_str(),
|
||||||
|
config.width, config.height)));
|
||||||
|
}
|
||||||
return absl::make_unique<AnalyzingFrameGenerator>(
|
return absl::make_unique<AnalyzingFrameGenerator>(
|
||||||
std::move(stream_label), std::move(delegate), analyzer_.get(),
|
std::move(*config.stream_label), std::move(delegate), analyzer_.get(),
|
||||||
std::move(sinks));
|
std::move(sinks));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>
|
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>
|
||||||
VideoQualityAnalyzerInjectionHelper::CreateVideoSink(
|
VideoQualityAnalyzerInjectionHelper::CreateVideoSink(
|
||||||
|
const VideoConfig& config,
|
||||||
test::VideoFrameWriter* writer) const {
|
test::VideoFrameWriter* writer) const {
|
||||||
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>> sinks;
|
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>> sinks;
|
||||||
if (writer) {
|
if (writer) {
|
||||||
sinks.push_back(absl::make_unique<VideoWriter>(writer));
|
sinks.push_back(absl::make_unique<VideoWriter>(writer));
|
||||||
}
|
}
|
||||||
|
if (config.show_on_screen) {
|
||||||
|
sinks.push_back(absl::WrapUnique(
|
||||||
|
test::VideoRenderer::Create((*config.stream_label + "-render").c_str(),
|
||||||
|
config.width, config.height)));
|
||||||
|
}
|
||||||
return absl::make_unique<AnalyzingVideoSink>(analyzer_.get(),
|
return absl::make_unique<AnalyzingVideoSink>(analyzer_.get(),
|
||||||
std::move(sinks));
|
std::move(sinks));
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "api/test/peerconnection_quality_test_fixture.h"
|
||||||
#include "api/test/stats_observer_interface.h"
|
#include "api/test/stats_observer_interface.h"
|
||||||
#include "api/test/video_quality_analyzer_interface.h"
|
#include "api/test/video_quality_analyzer_interface.h"
|
||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
@ -33,6 +34,8 @@ namespace webrtc_pc_e2e {
|
|||||||
// VideoQualityAnalyzerInterface into PeerConnection pipeline.
|
// VideoQualityAnalyzerInterface into PeerConnection pipeline.
|
||||||
class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
|
class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
|
||||||
public:
|
public:
|
||||||
|
using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig;
|
||||||
|
|
||||||
VideoQualityAnalyzerInjectionHelper(
|
VideoQualityAnalyzerInjectionHelper(
|
||||||
std::unique_ptr<VideoQualityAnalyzerInterface> analyzer,
|
std::unique_ptr<VideoQualityAnalyzerInterface> analyzer,
|
||||||
EncodedImageDataInjector* injector,
|
EncodedImageDataInjector* injector,
|
||||||
@ -55,13 +58,14 @@ class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
|
|||||||
// captured frames. If |writer| in not nullptr, will dump captured frames
|
// captured frames. If |writer| in not nullptr, will dump captured frames
|
||||||
// with provided writer.
|
// with provided writer.
|
||||||
std::unique_ptr<test::FrameGenerator> WrapFrameGenerator(
|
std::unique_ptr<test::FrameGenerator> WrapFrameGenerator(
|
||||||
std::string stream_label,
|
const VideoConfig& config,
|
||||||
std::unique_ptr<test::FrameGenerator> delegate,
|
std::unique_ptr<test::FrameGenerator> delegate,
|
||||||
test::VideoFrameWriter* writer) const;
|
test::VideoFrameWriter* writer) const;
|
||||||
// Creates sink, that will allow video quality analyzer to get access to the
|
// Creates sink, that will allow video quality analyzer to get access to the
|
||||||
// rendered frames. If |writer| in not nullptr, will dump rendered frames
|
// rendered frames. If |writer| in not nullptr, will dump rendered frames
|
||||||
// with provided writer.
|
// with provided writer.
|
||||||
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> CreateVideoSink(
|
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> CreateVideoSink(
|
||||||
|
const VideoConfig& config,
|
||||||
test::VideoFrameWriter* writer) const;
|
test::VideoFrameWriter* writer) const;
|
||||||
|
|
||||||
void Start(std::string test_case_name, int max_threads_count);
|
void Start(std::string test_case_name, int max_threads_count);
|
||||||
|
@ -590,7 +590,8 @@ void PeerConnectionE2EQualityTest::OnTrackCallback(
|
|||||||
// track->kind() is kVideoKind.
|
// track->kind() is kVideoKind.
|
||||||
auto* video_track = static_cast<VideoTrackInterface*>(track.get());
|
auto* video_track = static_cast<VideoTrackInterface*>(track.get());
|
||||||
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> video_sink =
|
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> video_sink =
|
||||||
video_quality_analyzer_injection_helper_->CreateVideoSink(writer);
|
video_quality_analyzer_injection_helper_->CreateVideoSink(*video_config,
|
||||||
|
writer);
|
||||||
video_track->AddOrUpdateSink(video_sink.get(), rtc::VideoSinkWants());
|
video_track->AddOrUpdateSink(video_sink.get(), rtc::VideoSinkWants());
|
||||||
output_video_sinks_.push_back(std::move(video_sink));
|
output_video_sinks_.push_back(std::move(video_sink));
|
||||||
}
|
}
|
||||||
@ -680,8 +681,7 @@ PeerConnectionE2EQualityTest::MaybeAddVideo(TestPeer* peer) {
|
|||||||
MaybeCreateVideoWriter(video_config.input_dump_file_name, video_config);
|
MaybeCreateVideoWriter(video_config.input_dump_file_name, video_config);
|
||||||
frame_generator =
|
frame_generator =
|
||||||
video_quality_analyzer_injection_helper_->WrapFrameGenerator(
|
video_quality_analyzer_injection_helper_->WrapFrameGenerator(
|
||||||
video_config.stream_label.value(), std::move(frame_generator),
|
video_config, std::move(frame_generator), writer);
|
||||||
writer);
|
|
||||||
|
|
||||||
// Setup FrameGenerator into peer connection.
|
// Setup FrameGenerator into peer connection.
|
||||||
auto capturer = absl::make_unique<test::FrameGeneratorCapturer>(
|
auto capturer = absl::make_unique<test::FrameGeneratorCapturer>(
|
||||||
|
Reference in New Issue
Block a user