[Adaptation] Add more ResourceAdaptationProcessor logging.
This should help debugging when adaptation is or is not happening
unexpectedly. Log spam is prevented by not logging if the same
result happened to the same resource already and we haven't
adapted since then.
Bug: webrtc:11616
Change-Id: Ia6c5cc35061d252f1c66f2f2bf3b94d2485498d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176221
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31378}
diff --git a/api/rtp_parameters.cc b/api/rtp_parameters.cc
index a05b2bf..c44e4c4 100644
--- a/api/rtp_parameters.cc
+++ b/api/rtp_parameters.cc
@@ -18,6 +18,20 @@
namespace webrtc {
+const char* DegradationPreferenceToString(
+ DegradationPreference degradation_preference) {
+ switch (degradation_preference) {
+ case DegradationPreference::DISABLED:
+ return "disabled";
+ case DegradationPreference::MAINTAIN_FRAMERATE:
+ return "maintain-framerate";
+ case DegradationPreference::MAINTAIN_RESOLUTION:
+ return "maintain-resolution";
+ case DegradationPreference::BALANCED:
+ return "balanced";
+ }
+}
+
const double kDefaultBitratePriority = 1.0;
RtcpFeedback::RtcpFeedback() = default;
diff --git a/api/rtp_parameters.h b/api/rtp_parameters.h
index d7156db..f831e51 100644
--- a/api/rtp_parameters.h
+++ b/api/rtp_parameters.h
@@ -92,6 +92,9 @@
BALANCED,
};
+RTC_EXPORT const char* DegradationPreferenceToString(
+ DegradationPreference degradation_preference);
+
RTC_EXPORT extern const double kDefaultBitratePriority;
struct RTC_EXPORT RtcpFeedback {
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index 7f9b034..3bce91e 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -237,7 +237,10 @@
"video_adaptation_reason.h",
]
- deps = [ "../../rtc_base:checks" ]
+ deps = [
+ "../../rtc_base:checks",
+ "../../rtc_base:stringutils",
+ ]
}
rtc_source_set("video_stream_encoder") {
diff --git a/api/video/video_adaptation_counters.cc b/api/video/video_adaptation_counters.cc
index 25e0bee..df1769d 100644
--- a/api/video/video_adaptation_counters.cc
+++ b/api/video/video_adaptation_counters.cc
@@ -10,6 +10,8 @@
#include "api/video/video_adaptation_counters.h"
+#include "rtc_base/strings/string_builder.h"
+
namespace webrtc {
bool VideoAdaptationCounters::operator==(
@@ -30,4 +32,11 @@
fps_adaptations + other.fps_adaptations);
}
+std::string VideoAdaptationCounters::ToString() const {
+ rtc::StringBuilder ss;
+ ss << "{ res=" << resolution_adaptations << " fps=" << fps_adaptations
+ << " }";
+ return ss.Release();
+}
+
} // namespace webrtc
diff --git a/api/video/video_adaptation_counters.h b/api/video/video_adaptation_counters.h
index eff0baa..2dea902 100644
--- a/api/video/video_adaptation_counters.h
+++ b/api/video/video_adaptation_counters.h
@@ -11,6 +11,8 @@
#ifndef API_VIDEO_VIDEO_ADAPTATION_COUNTERS_H_
#define API_VIDEO_VIDEO_ADAPTATION_COUNTERS_H_
+#include <string>
+
#include "rtc_base/checks.h"
namespace webrtc {
@@ -33,6 +35,8 @@
VideoAdaptationCounters operator+(const VideoAdaptationCounters& other) const;
+ std::string ToString() const;
+
int resolution_adaptations;
int fps_adaptations;
};