| 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 |
| 11 | package org.webrtc; |
| 12 |
| 13 | import androidx.annotation.Nullable; |
| 14 | import java.util.List; |
| 15 | import java.util.Map; |
| 16 | import org.webrtc.MediaStreamTrack; |
| 17 |
| 18 | public class RtpCapabilities { |
| 19 | public static class CodecCapability { |
| 20 | public int preferredPayloadType; |
| 21 | // Name used to identify the codec. Equivalent to MIME subtype. |
| 22 | public String name; |
| 23 | // The media type of this codec. Equivalent to MIME top-level type. |
| 24 | public MediaStreamTrack.MediaType kind; |
| 25 | // Clock rate in Hertz. |
| 26 | public Integer clockRate; |
| 27 | // The number of audio channels used. Set to null for video codecs. |
| 28 | public Integer numChannels; |
| 29 | // The "format specific parameters" field from the "a=fmtp" line in the SDP |
| 30 | public Map<String, String> parameters; |
| 31 | // The MIME type of the codec. This is a convenience field. |
| 32 | public String mimeType; |
| 33 |
| 34 | public CodecCapability() {} |
| 35 |
| 36 | @CalledByNative("CodecCapability") |
| 37 | CodecCapability(int preferredPayloadType, String name, MediaStreamTrack.MediaType kind, |
| 38 | Integer clockRate, Integer numChannels, String mimeType, Map<String, String> parameters) { |
| 39 | this.preferredPayloadType = preferredPayloadType; |
| 40 | this.name = name; |
| 41 | this.kind = kind; |
| 42 | this.clockRate = clockRate; |
| 43 | this.numChannels = numChannels; |
| 44 | this.parameters = parameters; |
| 45 | this.mimeType = mimeType; |
| 46 | } |
| 47 |
| 48 | @CalledByNative("CodecCapability") |
| 49 | int getPreferredPayloadType() { |
| 50 | return preferredPayloadType; |
| 51 | } |
| 52 |
| 53 | @CalledByNative("CodecCapability") |
| 54 | String getName() { |
| 55 | return name; |
| 56 | } |
| 57 |
| 58 | @CalledByNative("CodecCapability") |
| 59 | MediaStreamTrack.MediaType getKind() { |
| 60 | return kind; |
| 61 | } |
| 62 |
| 63 | @CalledByNative("CodecCapability") |
| 64 | Integer getClockRate() { |
| 65 | return clockRate; |
| 66 | } |
| 67 |
| 68 | @CalledByNative("CodecCapability") |
| 69 | Integer getNumChannels() { |
| 70 | return numChannels; |
| 71 | } |
| 72 |
| 73 | @CalledByNative("CodecCapability") |
| 74 | Map getParameters() { |
| 75 | return parameters; |
| 76 | } |
| 77 | } |
| 78 |
| 79 | public static class HeaderExtensionCapability { |
| 80 | private final String uri; |
| 81 | private final int preferredId; |
| 82 | private final boolean preferredEncrypted; |
| 83 |
| 84 | @CalledByNative("HeaderExtensionCapability") |
| 85 | HeaderExtensionCapability(String uri, int preferredId, boolean preferredEncrypted) { |
| 86 | this.uri = uri; |
| 87 | this.preferredId = preferredId; |
| 88 | this.preferredEncrypted = preferredEncrypted; |
| 89 | } |
| 90 |
| 91 | @CalledByNative("HeaderExtensionCapability") |
| 92 | public String getUri() { |
| 93 | return uri; |
| 94 | } |
| 95 |
| 96 | @CalledByNative("HeaderExtensionCapability") |
| 97 | public int getPreferredId() { |
| 98 | return preferredId; |
| 99 | } |
| 100 |
| 101 | @CalledByNative("HeaderExtensionCapability") |
| 102 | public boolean getPreferredEncrypted() { |
| 103 | return preferredEncrypted; |
| 104 | } |
| 105 | } |
| 106 |
| 107 | public List<CodecCapability> codecs; |
| 108 | public List<HeaderExtensionCapability> headerExtensions; |
| 109 |
| 110 | @CalledByNative |
| 111 | RtpCapabilities(List<CodecCapability> codecs, List<HeaderExtensionCapability> headerExtensions) { |
| 112 | this.headerExtensions = headerExtensions; |
| 113 | this.codecs = codecs; |
| 114 | } |
| 115 |
| 116 | @CalledByNative |
| 117 | public List<HeaderExtensionCapability> getHeaderExtensions() { |
| 118 | return headerExtensions; |
| 119 | } |
| 120 |
| 121 | @CalledByNative |
| 122 | List<CodecCapability> getCodecs() { |
| 123 | return codecs; |
| 124 | } |
| 125 | } |
| 126 |