Do not use absl::flat_hash_map in DefaultVideoQualityAnalyzer.

This CL removes the usage of absl::flat_hash_map because it transitively
depends on CCTZ which fails to link with lld-link after the switch to
libc++.

Since std::map doesn't support heterogeneous lookup until C++14, this
CL also stops using absl::string_view and switches to
`const std::string&`.

Bug: webrtc:10605
Change-Id: I4fc93969c6fc0cc7e7e62b4d2f801bdd27cff0f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135566
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27877}
This commit is contained in:
Mirko Bonadei
2019-05-08 10:52:52 +02:00
committed by Commit Bot
parent 6cdbf3fd74
commit 60f14ce217
11 changed files with 13 additions and 25 deletions

View File

@ -213,7 +213,6 @@ rtc_source_set("video_quality_analyzer_api") {
"video:encoded_image",
"video:video_frame",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -247,7 +246,6 @@ rtc_source_set("stats_observer_interface") {
deps = [
":libjingle_peerconnection_api",
"//third_party/abseil-cpp/absl/strings",
]
}

View File

@ -11,7 +11,8 @@
#ifndef API_TEST_STATS_OBSERVER_INTERFACE_H_
#define API_TEST_STATS_OBSERVER_INTERFACE_H_
#include "absl/strings/string_view.h"
#include <string>
#include "api/stats_types.h"
namespace webrtc {
@ -24,7 +25,7 @@ class StatsObserverInterface {
// Method called when stats reports are available for the PeerConnection
// identified by |pc_label|.
virtual void OnStatsReports(absl::string_view pc_label,
virtual void OnStatsReports(const std::string& pc_label,
const StatsReports& reports) = 0;
};

View File

@ -14,7 +14,6 @@
#include <memory>
#include <string>
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/test/stats_observer_interface.h"
#include "api/video/encoded_image.h"
@ -99,7 +98,7 @@ class VideoQualityAnalyzerInterface : public StatsObserverInterface {
virtual void OnDecoderError(uint16_t frame_id, int32_t error_code) {}
// Will be called everytime new stats reports are available for the
// Peer Connection identified by |pc_label|.
void OnStatsReports(absl::string_view pc_label,
void OnStatsReports(const std::string& pc_label,
const StatsReports& stats_reports) override {}
// Tells analyzer that analysis complete and it should calculate final

View File

@ -20,10 +20,6 @@ include_rules = [
"+sdk",
"+system_wrappers",
"+third_party/libyuv",
# This should probably go into //DEPS but at the moment we don't know
# yet if this is OK to use in production code.
"+absl/container/flat_hash_map.h",
]
specific_include_rules = {

View File

@ -192,7 +192,6 @@ if (rtc_include_tests) {
"../../../test:video_test_common",
"../../../test:video_test_support",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
]
}
@ -412,7 +411,6 @@ rtc_source_set("default_audio_quality_analyzer") {
"../../../rtc_base:criticalsection",
"../../../rtc_base:logging",
"../../../rtc_base:rtc_numerics",
"//third_party/abseil-cpp/absl/strings",
]
}
@ -459,7 +457,6 @@ rtc_source_set("default_video_quality_analyzer") {
"../../../rtc_base:rtc_event",
"../../../rtc_base:rtc_numerics",
"../../../system_wrappers",
"//third_party/abseil-cpp/absl/container:flat_hash_map",
"//third_party/abseil-cpp/absl/memory",
]
}

View File

@ -30,7 +30,7 @@ void DefaultAudioQualityAnalyzer::Start(
}
void DefaultAudioQualityAnalyzer::OnStatsReports(
absl::string_view pc_label,
const std::string& pc_label,
const StatsReports& stats_reports) {
for (const StatsReport* stats_report : stats_reports) {
// NetEq stats are only present in kStatsReportTypeSsrc reports, so all

View File

@ -14,7 +14,6 @@
#include <map>
#include <string>
#include "absl/strings/string_view.h"
#include "api/stats_types.h"
#include "api/test/audio_quality_analyzer_interface.h"
#include "api/test/track_id_stream_label_map.h"
@ -38,7 +37,7 @@ class DefaultAudioQualityAnalyzer : public AudioQualityAnalyzerInterface {
public:
void Start(std::string test_case_name,
TrackIdStreamLabelMap* analyzer_helper) override;
void OnStatsReports(absl::string_view pc_label,
void OnStatsReports(const std::string& pc_label,
const StatsReports& stats_reports) override;
void Stop() override;

View File

@ -355,7 +355,7 @@ AnalyzerStats DefaultVideoQualityAnalyzer::GetAnalyzerStats() const {
// TODO(bugs.webrtc.org/10430): Migrate to the new GetStats as soon as
// bugs.webrtc.org/10428 is fixed.
void DefaultVideoQualityAnalyzer::OnStatsReports(
absl::string_view pc_label,
const std::string& pc_label,
const StatsReports& stats_reports) {
for (const StatsReport* stats_report : stats_reports) {
// The only stats collected by this analyzer are present in
@ -399,7 +399,7 @@ void DefaultVideoQualityAnalyzer::OnStatsReports(
}
}
absl::flat_hash_map<std::string, VideoBweStats>
std::map<std::string, VideoBweStats>
DefaultVideoQualityAnalyzer::GetVideoBweStats() const {
rtc::CritScope crit(&video_bwe_stats_lock_);
return video_bwe_stats_;

View File

@ -19,7 +19,6 @@
#include <string>
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "api/test/video_quality_analyzer_interface.h"
#include "api/units/timestamp.h"
#include "api/video/encoded_image.h"
@ -157,10 +156,10 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
// Will be called everytime new stats reports are available for the
// Peer Connection identified by |pc_label|.
void OnStatsReports(absl::string_view pc_label,
void OnStatsReports(const std::string& pc_label,
const StatsReports& stats_reports) override;
absl::flat_hash_map<std::string, VideoBweStats> GetVideoBweStats() const;
std::map<std::string, VideoBweStats> GetVideoBweStats() const;
private:
struct FrameStats {
@ -287,7 +286,7 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
rtc::CriticalSection video_bwe_stats_lock_;
// Map between a peer connection label (provided by the framework) and
// its video BWE stats.
absl::flat_hash_map<std::string, VideoBweStats> video_bwe_stats_
std::map<std::string, VideoBweStats> video_bwe_stats_
RTC_GUARDED_BY(video_bwe_stats_lock_);
std::vector<std::unique_ptr<rtc::PlatformThread>> thread_pool_;

View File

@ -141,7 +141,7 @@ void VideoQualityAnalyzerInjectionHelper::Start(std::string test_case_name,
}
void VideoQualityAnalyzerInjectionHelper::OnStatsReports(
absl::string_view pc_label,
const std::string& pc_label,
const StatsReports& stats_reports) {
analyzer_->OnStatsReports(pc_label, stats_reports);
}

View File

@ -15,7 +15,6 @@
#include <memory>
#include <string>
#include "absl/strings/string_view.h"
#include "api/test/stats_observer_interface.h"
#include "api/test/video_quality_analyzer_interface.h"
#include "api/video/video_frame.h"
@ -69,7 +68,7 @@ class VideoQualityAnalyzerInjectionHelper : public StatsObserverInterface {
// Forwards |stats_reports| for Peer Connection |pc_label| to
// |analyzer_|.
void OnStatsReports(absl::string_view pc_label,
void OnStatsReports(const std::string& pc_label,
const StatsReports& stats_reports) override;
// Stops VideoQualityAnalyzerInterface to populate final data and metrics.