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

Unified Diff: webrtc/api/mediatypes.cc

Issue 2675173003: Adding "adapter" ORTC objects on top of ChannelManager/BaseChannel/etc. (Closed)
Patch Set: Add memcheck suppression for end-to-end tests. Created 3 years, 10 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
« no previous file with comments | « webrtc/api/mediatypes.h ('k') | webrtc/api/ortc/ortcfactoryinterface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/mediatypes.cc
diff --git a/webrtc/api/mediatypes.cc b/webrtc/api/mediatypes.cc
index 97b0189b7a9349396219aa69a6df3adf5a124520..fbcb53d85b272a6db147df56c4d0a8c70ed96976 100644
--- a/webrtc/api/mediatypes.cc
+++ b/webrtc/api/mediatypes.cc
@@ -9,27 +9,39 @@
*/
#include "webrtc/api/mediatypes.h"
+
+#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/base/checks.h"
+namespace {
+static const char* kMediaTypeData = "data";
+} // namespace
+
namespace cricket {
std::string MediaTypeToString(MediaType type) {
- std::string type_str;
switch (type) {
case MEDIA_TYPE_AUDIO:
- type_str = "audio";
- break;
+ return webrtc::MediaStreamTrackInterface::kAudioKind;
case MEDIA_TYPE_VIDEO:
- type_str = "video";
- break;
+ return webrtc::MediaStreamTrackInterface::kVideoKind;
case MEDIA_TYPE_DATA:
- type_str = "data";
- break;
- default:
- RTC_NOTREACHED();
- break;
+ return kMediaTypeData;
+ }
+ // Not reachable; avoids compile warning.
+ FATAL();
+}
+
+MediaType MediaTypeFromString(const std::string& type_str) {
+ if (type_str == webrtc::MediaStreamTrackInterface::kAudioKind) {
+ return MEDIA_TYPE_AUDIO;
+ } else if (type_str == webrtc::MediaStreamTrackInterface::kVideoKind) {
+ return MEDIA_TYPE_VIDEO;
+ } else if (type_str == kMediaTypeData) {
+ return MEDIA_TYPE_DATA;
+ } else {
+ FATAL();
}
- return type_str;
}
} // namespace cricket
« no previous file with comments | « webrtc/api/mediatypes.h ('k') | webrtc/api/ortc/ortcfactoryinterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698