Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: webrtc/modules/audio_coding/codecs/audio_format.cc

Issue 2072753002: WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rewrote PayloadMapperTest to not rely on value comparison operators of rtc::Optional. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/audio_format.cc
diff --git a/webrtc/modules/audio_coding/codecs/audio_format.cc b/webrtc/modules/audio_coding/codecs/audio_format.cc
index bb69cbdb2f73be7f36f7983a0a4b7ae662cc03d1..22c8520ca8e1aa4762eeff3e75fba74b17994e56 100644
--- a/webrtc/modules/audio_coding/codecs/audio_format.cc
+++ b/webrtc/modules/audio_coding/codecs/audio_format.cc
@@ -10,6 +10,8 @@
#include "webrtc/modules/audio_coding/codecs/audio_format.h"
+#include "webrtc/common_types.h"
+
namespace webrtc {
SdpAudioFormat::SdpAudioFormat() = default;
@@ -34,6 +36,19 @@ SdpAudioFormat::~SdpAudioFormat() = default;
SdpAudioFormat& SdpAudioFormat::operator=(const SdpAudioFormat&) = default;
SdpAudioFormat& SdpAudioFormat::operator=(SdpAudioFormat&&) = default;
+bool SdpAudioFormat::operator<(const SdpAudioFormat& b) const {
+ if (clockrate_hz == b.clockrate_hz) {
+ if (num_channels == b.num_channels) {
+ int name_cmp = STR_CASE_CMP(name.c_str(), b.name.c_str());
ivoc 2016/07/05 14:43:51 Isn't it possible to just do: if (name == b.name)
ossu 2016/07/05 15:31:57 Well, no, we allow any capitalization of format na
ivoc 2016/07/06 15:24:51 Sounds like it would be nice to just convert every
+ if (name_cmp == 0)
+ return parameters < b.parameters;
+ return name_cmp < 0;
+ }
+ return num_channels < b.num_channels;
+ }
+ return clockrate_hz < b.clockrate_hz;
+}
+
void swap(SdpAudioFormat& a, SdpAudioFormat& b) {
using std::swap;
swap(a.name, b.name);

Powered by Google App Engine
This is Rietveld 408576698