mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 22:00:47 +01:00
Remove deprecated CreateVideoSink method.
Change-Id: Ifc71a7aeb51d8f5fd68bb78ac8516b755b46b52e Bug: None Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301101 Reviewed-by: Artem Titov <titovartem@webrtc.org> Commit-Queue: Jeremy Leconte <jleconte@google.com> Cr-Commit-Position: refs/heads/main@{#39844}
This commit is contained in:
parent
7720331b40
commit
514829cac8
2 changed files with 0 additions and 129 deletions
|
@ -132,21 +132,11 @@ VideoQualityAnalyzerInjectionHelper::CreateFramePreprocessor(
|
||||||
config.width, config.height)));
|
config.width, config.height)));
|
||||||
}
|
}
|
||||||
sinks_helper_.AddConfig(peer_name, config);
|
sinks_helper_.AddConfig(peer_name, config);
|
||||||
{
|
|
||||||
MutexLock lock(&mutex_);
|
|
||||||
known_video_configs_.insert({*config.stream_label, config});
|
|
||||||
}
|
|
||||||
return std::make_unique<AnalyzingFramePreprocessor>(
|
return std::make_unique<AnalyzingFramePreprocessor>(
|
||||||
peer_name, std::move(*config.stream_label), analyzer_.get(),
|
peer_name, std::move(*config.stream_label), analyzer_.get(),
|
||||||
std::move(sinks));
|
std::move(sinks));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>
|
|
||||||
VideoQualityAnalyzerInjectionHelper::CreateVideoSink(
|
|
||||||
absl::string_view peer_name) {
|
|
||||||
return std::make_unique<AnalyzingVideoSink2>(peer_name, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<AnalyzingVideoSink>
|
std::unique_ptr<AnalyzingVideoSink>
|
||||||
VideoQualityAnalyzerInjectionHelper::CreateVideoSink(
|
VideoQualityAnalyzerInjectionHelper::CreateVideoSink(
|
||||||
absl::string_view peer_name,
|
absl::string_view peer_name,
|
||||||
|
@ -163,24 +153,18 @@ void VideoQualityAnalyzerInjectionHelper::Start(
|
||||||
int max_threads_count) {
|
int max_threads_count) {
|
||||||
analyzer_->Start(std::move(test_case_name), peer_names, max_threads_count);
|
analyzer_->Start(std::move(test_case_name), peer_names, max_threads_count);
|
||||||
extractor_->Start(peer_names.size());
|
extractor_->Start(peer_names.size());
|
||||||
MutexLock lock(&mutex_);
|
|
||||||
peers_count_ = peer_names.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoQualityAnalyzerInjectionHelper::RegisterParticipantInCall(
|
void VideoQualityAnalyzerInjectionHelper::RegisterParticipantInCall(
|
||||||
absl::string_view peer_name) {
|
absl::string_view peer_name) {
|
||||||
analyzer_->RegisterParticipantInCall(peer_name);
|
analyzer_->RegisterParticipantInCall(peer_name);
|
||||||
extractor_->AddParticipantInCall();
|
extractor_->AddParticipantInCall();
|
||||||
MutexLock lock(&mutex_);
|
|
||||||
peers_count_++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoQualityAnalyzerInjectionHelper::UnregisterParticipantInCall(
|
void VideoQualityAnalyzerInjectionHelper::UnregisterParticipantInCall(
|
||||||
absl::string_view peer_name) {
|
absl::string_view peer_name) {
|
||||||
analyzer_->UnregisterParticipantInCall(peer_name);
|
analyzer_->UnregisterParticipantInCall(peer_name);
|
||||||
extractor_->RemoveParticipantInCall();
|
extractor_->RemoveParticipantInCall();
|
||||||
MutexLock lock(&mutex_);
|
|
||||||
peers_count_--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoQualityAnalyzerInjectionHelper::OnStatsReports(
|
void VideoQualityAnalyzerInjectionHelper::OnStatsReports(
|
||||||
|
@ -198,67 +182,5 @@ void VideoQualityAnalyzerInjectionHelper::Stop() {
|
||||||
sinks_helper_.Clear();
|
sinks_helper_.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoQualityAnalyzerInjectionHelper::OnFrame(absl::string_view peer_name,
|
|
||||||
const VideoFrame& frame) {
|
|
||||||
if (IsDummyFrame(frame)) {
|
|
||||||
// This is dummy frame, so we don't need to process it further.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Copy entire video frame including video buffer to ensure that analyzer
|
|
||||||
// won't hold any WebRTC internal buffers.
|
|
||||||
VideoFrame frame_copy = frame;
|
|
||||||
frame_copy.set_video_frame_buffer(
|
|
||||||
I420Buffer::Copy(*frame.video_frame_buffer()->ToI420()));
|
|
||||||
analyzer_->OnFrameRendered(peer_name, frame_copy);
|
|
||||||
|
|
||||||
if (frame.id() != VideoFrame::kNotSetId) {
|
|
||||||
std::string stream_label = analyzer_->GetStreamLabel(frame.id());
|
|
||||||
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>>* sinks =
|
|
||||||
PopulateSinks(ReceiverStream(peer_name, stream_label));
|
|
||||||
if (sinks == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (auto& sink : *sinks) {
|
|
||||||
sink->OnFrame(frame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>>*
|
|
||||||
VideoQualityAnalyzerInjectionHelper::PopulateSinks(
|
|
||||||
const ReceiverStream& receiver_stream) {
|
|
||||||
MutexLock lock(&mutex_);
|
|
||||||
auto sinks_it = sinks_.find(receiver_stream);
|
|
||||||
if (sinks_it != sinks_.end()) {
|
|
||||||
return &sinks_it->second;
|
|
||||||
}
|
|
||||||
auto it = known_video_configs_.find(receiver_stream.stream_label);
|
|
||||||
RTC_DCHECK(it != known_video_configs_.end())
|
|
||||||
<< "No video config for stream " << receiver_stream.stream_label;
|
|
||||||
const VideoConfig& config = it->second;
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>> sinks;
|
|
||||||
if (config.output_dump_options.has_value()) {
|
|
||||||
std::unique_ptr<test::VideoFrameWriter> writer =
|
|
||||||
config.output_dump_options->CreateOutputDumpVideoFrameWriter(
|
|
||||||
receiver_stream.stream_label, receiver_stream.peer_name,
|
|
||||||
config.GetResolution());
|
|
||||||
if (config.output_dump_use_fixed_framerate) {
|
|
||||||
writer = std::make_unique<test::FixedFpsVideoFrameWriterAdapter>(
|
|
||||||
config.fps, clock_, std::move(writer));
|
|
||||||
}
|
|
||||||
sinks.push_back(std::make_unique<VideoWriter>(
|
|
||||||
writer.get(), config.output_dump_options->sampling_modulo()));
|
|
||||||
video_writers_.push_back(std::move(writer));
|
|
||||||
}
|
|
||||||
if (config.show_on_screen) {
|
|
||||||
sinks.push_back(absl::WrapUnique(
|
|
||||||
test::VideoRenderer::Create((*config.stream_label + "-render").c_str(),
|
|
||||||
config.width, config.height)));
|
|
||||||
}
|
|
||||||
sinks_.insert({receiver_stream, std::move(sinks)});
|
|
||||||
return &(sinks_.find(receiver_stream)->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace webrtc_pc_e2e
|
} // namespace webrtc_pc_e2e
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -75,9 +75,6 @@ class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
|
||||||
// `output_dump_file_name` in its VideoConfig, which was used for
|
// `output_dump_file_name` in its VideoConfig, which was used for
|
||||||
// CreateFramePreprocessor(...), then video also will be written
|
// CreateFramePreprocessor(...), then video also will be written
|
||||||
// into that file.
|
// into that file.
|
||||||
// TODO(titovartem): Remove method with `peer_name` only parameter.
|
|
||||||
std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> CreateVideoSink(
|
|
||||||
absl::string_view peer_name);
|
|
||||||
std::unique_ptr<AnalyzingVideoSink> CreateVideoSink(
|
std::unique_ptr<AnalyzingVideoSink> CreateVideoSink(
|
||||||
absl::string_view peer_name,
|
absl::string_view peer_name,
|
||||||
const VideoSubscription& subscription,
|
const VideoSubscription& subscription,
|
||||||
|
@ -106,46 +103,6 @@ class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Deprecated, to be removed when old API isn't used anymore.
|
|
||||||
class AnalyzingVideoSink2 final : public rtc::VideoSinkInterface<VideoFrame> {
|
|
||||||
public:
|
|
||||||
explicit AnalyzingVideoSink2(absl::string_view peer_name,
|
|
||||||
VideoQualityAnalyzerInjectionHelper* helper)
|
|
||||||
: peer_name_(peer_name), helper_(helper) {}
|
|
||||||
~AnalyzingVideoSink2() override = default;
|
|
||||||
|
|
||||||
void OnFrame(const VideoFrame& frame) override {
|
|
||||||
helper_->OnFrame(peer_name_, frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::string peer_name_;
|
|
||||||
VideoQualityAnalyzerInjectionHelper* const helper_;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ReceiverStream {
|
|
||||||
ReceiverStream(absl::string_view peer_name, absl::string_view stream_label)
|
|
||||||
: peer_name(peer_name), stream_label(stream_label) {}
|
|
||||||
|
|
||||||
std::string peer_name;
|
|
||||||
std::string stream_label;
|
|
||||||
|
|
||||||
// Define operators required to use ReceiverStream as std::map key.
|
|
||||||
bool operator==(const ReceiverStream& o) const {
|
|
||||||
return peer_name == o.peer_name && stream_label == o.stream_label;
|
|
||||||
}
|
|
||||||
bool operator<(const ReceiverStream& o) const {
|
|
||||||
return (peer_name == o.peer_name) ? stream_label < o.stream_label
|
|
||||||
: peer_name < o.peer_name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Creates a deep copy of the frame and passes it to the video analyzer, while
|
|
||||||
// passing real frame to the sinks
|
|
||||||
void OnFrame(absl::string_view peer_name, const VideoFrame& frame);
|
|
||||||
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>>*
|
|
||||||
PopulateSinks(const ReceiverStream& receiver_stream);
|
|
||||||
|
|
||||||
Clock* const clock_;
|
Clock* const clock_;
|
||||||
std::unique_ptr<VideoQualityAnalyzerInterface> analyzer_;
|
std::unique_ptr<VideoQualityAnalyzerInterface> analyzer_;
|
||||||
EncodedImageDataInjector* injector_;
|
EncodedImageDataInjector* injector_;
|
||||||
|
@ -154,14 +111,6 @@ class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
|
||||||
std::vector<std::unique_ptr<test::VideoFrameWriter>> video_writers_;
|
std::vector<std::unique_ptr<test::VideoFrameWriter>> video_writers_;
|
||||||
|
|
||||||
AnalyzingVideoSinksHelper sinks_helper_;
|
AnalyzingVideoSinksHelper sinks_helper_;
|
||||||
Mutex mutex_;
|
|
||||||
int peers_count_ RTC_GUARDED_BY(mutex_);
|
|
||||||
// Map from stream label to the video config.
|
|
||||||
std::map<std::string, webrtc::webrtc_pc_e2e::VideoConfig> known_video_configs_
|
|
||||||
RTC_GUARDED_BY(mutex_);
|
|
||||||
std::map<ReceiverStream,
|
|
||||||
std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>>>
|
|
||||||
sinks_ RTC_GUARDED_BY(mutex_);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc_pc_e2e
|
} // namespace webrtc_pc_e2e
|
||||||
|
|
Loading…
Reference in a new issue