• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "cast/streaming/rtp_defines.h"
6 
7 namespace openscreen {
8 namespace cast {
9 
GetPayloadType(AudioCodec codec)10 RtpPayloadType GetPayloadType(AudioCodec codec) {
11   return RtpPayloadType::kAudioHackForAndroidTV;
12 }
13 
GetPayloadType(VideoCodec codec)14 RtpPayloadType GetPayloadType(VideoCodec codec) {
15   return RtpPayloadType::kVideoHackForAndroidTV;
16 }
17 
IsRtpPayloadType(uint8_t raw_byte)18 bool IsRtpPayloadType(uint8_t raw_byte) {
19   switch (static_cast<RtpPayloadType>(raw_byte)) {
20     case RtpPayloadType::kAudioOpus:
21     case RtpPayloadType::kAudioAac:
22     case RtpPayloadType::kAudioPcm16:
23     case RtpPayloadType::kAudioVarious:
24     case RtpPayloadType::kVideoVp8:
25     case RtpPayloadType::kVideoH264:
26     case RtpPayloadType::kVideoVarious:
27     case RtpPayloadType::kAudioHackForAndroidTV:
28       // Note: RtpPayloadType::kVideoHackForAndroidTV has the same value as
29       // kAudioOpus.
30       return true;
31 
32     case RtpPayloadType::kNull:
33       break;
34   }
35   return false;
36 }
37 
IsRtcpPacketType(uint8_t raw_byte)38 bool IsRtcpPacketType(uint8_t raw_byte) {
39   switch (static_cast<RtcpPacketType>(raw_byte)) {
40     case RtcpPacketType::kSenderReport:
41     case RtcpPacketType::kReceiverReport:
42     case RtcpPacketType::kSourceDescription:
43     case RtcpPacketType::kApplicationDefined:
44     case RtcpPacketType::kPayloadSpecific:
45     case RtcpPacketType::kExtendedReports:
46       return true;
47 
48     case RtcpPacketType::kNull:
49       break;
50   }
51   return false;
52 }
53 
54 }  // namespace cast
55 }  // namespace openscreen
56