# RtpPayloadFormat

Artifact: [androidx.media3:media3-exoplayer-rtsp](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/rtsp/RtpPayloadFormat.java+class:androidx.media3.exoplayer.rtsp.RtpPayloadFormat)

*** ** * ** ***


```
@UnstableApi
class RtpPayloadFormat
```

<br />

*** ** * ** ***

Represents the payload format used in RTP.

In RTSP playback, the format information is always present in the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/SessionDescription` enclosed in the response of a DESCRIBE request. Within each track's `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/MediaDescription`, it is the attributes FMTP and RTPMAP that allows us to recreate the media format.

This class wraps around the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` class, in addition to the instance fields that are specific to RTP.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_AC3() = "AC3"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_AMR() = "AMR"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_AMR_WB() = "AMR-WB"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_H263_1998() = "H263-1998"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_H263_2000() = "H263-2000"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_H264() = "H264"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_H265() = "H265"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_MPEG4_GENERIC() = "MPEG4-GENERIC"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_MPEG4_LATM_AUDIO() = "MP4A-LATM"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_MPEG4_VIDEO() = "MP4V-ES"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_OPUS() = "OPUS"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_PCMA() = "PCMA"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_PCMU() = "PCMU"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_PCM_L16() = "L16"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_PCM_L8() = "L8"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_VP8() = "VP8"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RTP_MEDIA_VP9() = "VP9"` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#RtpPayloadFormat(androidx.media3.common.Format,int,int,java.util.Map<java.lang.String,java.lang.String>,java.lang.String)( format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, rtpPayloadType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, clockRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, fmtpParameters: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!, mediaEncoding: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html! )` Creates a new instance. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#equals(java.lang.Object)(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#getMimeTypeFromRtpMediaType(java.lang.String)(mediaType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Gets the MIME type that is associated with the RTP media type. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.PcmEncoding https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#getRawPcmEncodingType(java.lang.String)(mediaEncoding: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Returns the PCM encoding type for `mediaEncoding`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#hashCode()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#clockRate()` The clock rate in Hertz, associated with the format. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#fmtpParameters()` The format parameters, mapped from the SDP FMTP attribute (RFC2327 Page 22). |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#format()` The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of this RTP payload. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#mediaEncoding()` The RTP media encoding. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/RtpPayloadFormat#rtpPayloadType()` The payload type associated with this format. |

## Constants

### RTP_MEDIA_AC3

```
const val RTP_MEDIA_AC3 = "AC3": String!
```

### RTP_MEDIA_AMR

```
const val RTP_MEDIA_AMR = "AMR": String!
```

### RTP_MEDIA_AMR_WB

```
const val RTP_MEDIA_AMR_WB = "AMR-WB": String!
```

### RTP_MEDIA_H263_1998

```
const val RTP_MEDIA_H263_1998 = "H263-1998": String!
```

### RTP_MEDIA_H263_2000

```
const val RTP_MEDIA_H263_2000 = "H263-2000": String!
```

### RTP_MEDIA_H264

```
const val RTP_MEDIA_H264 = "H264": String!
```

### RTP_MEDIA_H265

```
const val RTP_MEDIA_H265 = "H265": String!
```

### RTP_MEDIA_MPEG4_GENERIC

```
const val RTP_MEDIA_MPEG4_GENERIC = "MPEG4-GENERIC": String!
```

### RTP_MEDIA_MPEG4_LATM_AUDIO

```
const val RTP_MEDIA_MPEG4_LATM_AUDIO = "MP4A-LATM": String!
```

### RTP_MEDIA_MPEG4_VIDEO

```
const val RTP_MEDIA_MPEG4_VIDEO = "MP4V-ES": String!
```

### RTP_MEDIA_OPUS

```
const val RTP_MEDIA_OPUS = "OPUS": String!
```

### RTP_MEDIA_PCMA

```
const val RTP_MEDIA_PCMA = "PCMA": String!
```

### RTP_MEDIA_PCMU

```
const val RTP_MEDIA_PCMU = "PCMU": String!
```

### RTP_MEDIA_PCM_L16

```
const val RTP_MEDIA_PCM_L16 = "L16": String!
```

### RTP_MEDIA_PCM_L8

```
const val RTP_MEDIA_PCM_L8 = "L8": String!
```

### RTP_MEDIA_VP8

```
const val RTP_MEDIA_VP8 = "VP8": String!
```

### RTP_MEDIA_VP9

```
const val RTP_MEDIA_VP9 = "VP9": String!
```

## Public constructors

### RtpPayloadFormat

```
RtpPayloadFormat(
    format: Format!,
    rtpPayloadType: Int,
    clockRate: Int,
    fmtpParameters: (Mutable)Map<String!, String!>!,
    mediaEncoding: String!
)
```

Creates a new instance.

| Parameters |
|---|---|
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The associated `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`. |
| `rtpPayloadType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The assigned RTP payload type, from the RTPMAP attribute in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/rtsp/MediaDescription`. |
| `clockRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The associated clock rate in hertz. |
| `fmtpParameters: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | The format parameters, from the SDP FMTP attribute (RFC2327 Page 22), empty if unset. The keys and values are specified in the RFCs for specific formats. For instance, RFC3640 Section 4.1 defines keys like profile-level-id and config. |
| `mediaEncoding: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The RTP media encoding. |

## Public functions

### equals

```
fun equals(o: Any?): Boolean
```

### getMimeTypeFromRtpMediaType

```
java-static fun getMimeTypeFromRtpMediaType(mediaType: String!): String!
```

Gets the MIME type that is associated with the RTP media type.

For instance, RTP media type "H264" maps to `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_H264()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | When the media type is not supported/recognized. |

### getRawPcmEncodingType

```
@C.PcmEncoding
java-static fun getRawPcmEncodingType(mediaEncoding: String!): Int
```

Returns the PCM encoding type for `mediaEncoding`.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### hashCode

```
fun hashCode(): Int
```

## Public properties

### clockRate

```
val clockRate: Int
```

The clock rate in Hertz, associated with the format.

### fmtpParameters

```
val fmtpParameters: ImmutableMap<String!, String!>!
```

The format parameters, mapped from the SDP FMTP attribute (RFC2327 Page 22).

### format

```
val format: Format!
```

The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of this RTP payload.

### mediaEncoding

```
val mediaEncoding: String!
```

The RTP media encoding.

### rtpPayloadType

```
val rtpPayloadType: Int
```

The payload type associated with this format.