ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 11 | #include "api/media_types.h" |
deadbeef | e814a0d | 2017-02-26 02:15:09 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 13 | #include "rtc_base/checks.h" |
ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 14 | |
| 15 | namespace cricket { |
| 16 | |
Niels Möller | 6dcd4dc | 2019-08-26 08:45:28 | [diff] [blame] | 17 | const char kMediaTypeVideo[] = "video"; |
| 18 | const char kMediaTypeAudio[] = "audio"; |
| 19 | const char kMediaTypeData[] = "data"; |
| 20 | |
ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 21 | std::string MediaTypeToString(MediaType type) { |
ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 22 | switch (type) { |
| 23 | case MEDIA_TYPE_AUDIO: |
Niels Möller | 6dcd4dc | 2019-08-26 08:45:28 | [diff] [blame] | 24 | return kMediaTypeAudio; |
ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 25 | case MEDIA_TYPE_VIDEO: |
Niels Möller | 6dcd4dc | 2019-08-26 08:45:28 | [diff] [blame] | 26 | return kMediaTypeVideo; |
ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 27 | case MEDIA_TYPE_DATA: |
deadbeef | e814a0d | 2017-02-26 02:15:09 | [diff] [blame] | 28 | return kMediaTypeData; |
Philipp Hancke | 4e8c115 | 2020-10-13 10:43:15 | [diff] [blame] | 29 | case MEDIA_TYPE_UNSUPPORTED: |
| 30 | // Unsupported media stores the m=<mediatype> differently. |
Artem Titov | d325196 | 2021-11-15 15:57:07 | [diff] [blame] | 31 | RTC_DCHECK_NOTREACHED(); |
Philipp Hancke | 4e8c115 | 2020-10-13 10:43:15 | [diff] [blame] | 32 | return ""; |
ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 33 | } |
Karl Wiberg | c95b939 | 2020-11-07 23:49:37 | [diff] [blame] | 34 | RTC_CHECK_NOTREACHED(); |
deadbeef | e814a0d | 2017-02-26 02:15:09 | [diff] [blame] | 35 | } |
| 36 | |
ossu | 7bb87ee | 2017-01-23 12:56:25 | [diff] [blame] | 37 | } // namespace cricket |