Fixing some case-sensitive codec name comparisons.
As specified in RFC 4288, Section 4.2, and RFC 4855, Section 3, these
names should be case-insensitive. They already were being treated as
case-insensitive in some other places.
This bug was resulting in either a crash or no decoded video, depending
on the platform.
BUG=webrtc:6439, webrtc:7027
Review-Url: https://codereview.webrtc.org/2782273002
Cr-Commit-Position: refs/heads/master@{#17515}
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index 7cefa29..58751a6 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -18,6 +18,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/trace_event.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/system_wrappers/include/metrics.h"
@@ -50,15 +51,21 @@
HistogramCodecType PayloadNameToHistogramCodecType(
const std::string& payload_name) {
- if (payload_name == "VP8") {
- return kVideoVp8;
- } else if (payload_name == "VP9") {
- return kVideoVp9;
- } else if (payload_name == "H264") {
- return kVideoH264;
- } else {
+ rtc::Optional<VideoCodecType> codecType =
+ PayloadNameToCodecType(payload_name);
+ if (!codecType) {
return kVideoUnknown;
}
+ switch (*codecType) {
+ case kVideoCodecVP8:
+ return kVideoVp8;
+ case kVideoCodecVP9:
+ return kVideoVp9;
+ case kVideoCodecH264:
+ return kVideoH264;
+ default:
+ return kVideoUnknown;
+ }
}
void UpdateCodecTypeHistogram(const std::string& payload_name) {