Repository: pion/webrtc
Pull request #1800 (2021-05-01 00:22:54)

Update golang.org/x/net commit hash to 04defd4
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [golang.org/x/net](https://togithub.com/golang/net) | require | digest | `798c215` -> `04defd4` |

---

### Configuration

📅 **Schedule**: "on the first day of the month" (UTC).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/pion/webrtc).

renovate[bot]: ### :warning: Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

:recycle: Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or 
 - the branch becomes conflicted, or
 - you check the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: go.sum

```
Command failed: docker run --rm --name=renovate_go --label=renovate_child -v "/mnt/renovate/gh/pion/webrtc":"/mnt/renovate/gh/pion/webrtc" -v "/tmp/renovate-cache":"/tmp/renovate-cache" -v "/tmp/renovate-cache/others/go":"/tmp/renovate-cache/others/go" -e GOPATH -e CGO_ENABLED -w "/mnt/renovate/gh/pion/webrtc" docker.io/renovate/go:1.13.15 bash -l -c "git config --global url.\"https://**redacted**@github.com/\".insteadOf \"https://github.com/\" && go get -d ./... && go mod tidy && go mod tidy"
go: finding golang.org/x/net 89ef3d95e781
go: downloading github.com/pion/rtcp v1.2.6
go: downloading github.com/pion/interceptor v0.0.12
go: downloading github.com/pion/ice/v2 v2.1.7
go: downloading github.com/pion/logging v0.2.2
go: extracting github.com/pion/interceptor v0.0.12
go: extracting github.com/pion/rtcp v1.2.6
go: downloading github.com/pion/sctp v1.7.12
go: extracting github.com/pion/logging v0.2.2
go: downloading github.com/pion/rtp v1.6.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/pion/transport v0.12.3
go: extracting github.com/pion/ice/v2 v2.1.7
go: extracting github.com/pion/sctp v1.7.12
go: extracting github.com/pion/rtp v1.6.2
go: extracting github.com/pion/randutil v0.1.0
go: extracting github.com/pion/transport v0.12.3
go: downloading github.com/pion/srtp/v2 v2.0.2
go: extracting github.com/pion/srtp/v2 v2.0.2
go: downloading golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
go: extracting github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/pion/mdns v0.0.5
go: extracting github.com/pion/mdns v0.0.5
go: downloading github.com/pion/stun v0.3.5
go: downloading github.com/pion/sdp/v3 v3.0.4
go: extracting github.com/pion/stun v0.3.5
go: extracting github.com/pion/sdp/v3 v3.0.4
go: extracting golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
go: downloading github.com/pion/turn/v2 v2.0.5
go: downloading github.com/pion/udp v0.1.1
go: extracting github.com/pion/udp v0.1.1
go: extracting github.com/pion/turn/v2 v2.0.5
go: downloading golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/pion/datachannel v1.4.21
go: extracting github.com/pion/datachannel v1.4.21
go: extracting golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/sclevine/agouti v3.0.0+incompatible
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: extracting gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: extracting github.com/sclevine/agouti v3.0.0+incompatible
go: downloading github.com/onsi/gomega v1.11.0
go: downloading github.com/onsi/ginkgo v1.16.1
go: extracting github.com/onsi/gomega v1.11.0
go: downloading gopkg.in/yaml.v2 v2.4.0
go: extracting github.com/onsi/ginkgo v1.16.1
go: extracting gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
go: extracting github.com/nxadm/tail v1.4.8
go: extracting github.com/google/go-cmp v0.4.0
go: extracting google.golang.org/protobuf v1.23.0
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: extracting gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
github.com/pion/webrtc/v3 tested by
	github.com/pion/webrtc/v3.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200313102051-9f266ea9e77c: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/gomega imports
	github.com/onsi/gomega/matchers imports
	gopkg.in/yaml.v2: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v2@v2.4.0: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/ginkgo imports
	github.com/onsi/ginkgo/internal/remote imports
	github.com/nxadm/tail imports
	gopkg.in/tomb.v1: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/tomb.v1@v1.0.0-20141024135613-dd632973f1e7: permission denied

```


codecov[bot]: # [Codecov](https://codecov.io/gh/pion/webrtc/pull/1800?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) Report
> Merging [#1800](https://codecov.io/gh/pion/webrtc/pull/1800?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) (ed63b3b) into [master](https://codecov.io/gh/pion/webrtc/commit/9d59da54dfe96de3cdb4790837699787406296a1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) (9d59da5) will **decrease** coverage by `5.15%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pion/webrtc/pull/1800/graphs/tree.svg?width=650&height=150&src=pr&token=XOOuQo07I2&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion)](https://codecov.io/gh/pion/webrtc/pull/1800?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion)

```diff
@@            Coverage Diff             @@
##           master    #1800      +/-   ##
==========================================
- Coverage   75.02%   69.87%   -5.16%     
==========================================
  Files          81       59      -22     
  Lines        5863     2191    -3672     
==========================================
- Hits         4399     1531    -2868     
+ Misses       1078      553     -525     
+ Partials      386      107     -279     
```

| Flag | Coverage Δ | |
|---|---|---|
| go | `?` | |
| wasm | `69.87% <ø> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/pion/webrtc/pull/1800?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | |
|---|---|---|
| [icecandidatepair.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-aWNlY2FuZGlkYXRlcGFpci5nbw==) | `0.00% <0.00%> (-85.72%)` | :arrow_down: |
| [track\_local.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-dHJhY2tfbG9jYWwuZ28=) | `0.00% <0.00%> (-80.00%)` | :arrow_down: |
| [rtpcodec.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-cnRwY29kZWMuZ28=) | `15.00% <0.00%> (-75.00%)` | :arrow_down: |
| [stats.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-c3RhdHMuZ28=) | `0.00% <0.00%> (-67.86%)` | :arrow_down: |
| [internal/mux/muxfunc.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-aW50ZXJuYWwvbXV4L211eGZ1bmMuZ28=) | `5.26% <0.00%> (-57.90%)` | :arrow_down: |
| [icemux.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-aWNlbXV4Lmdv) | `0.00% <0.00%> (-55.56%)` | :arrow_down: |
| [gathering\_complete\_promise.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-Z2F0aGVyaW5nX2NvbXBsZXRlX3Byb21pc2UuZ28=) | `60.00% <0.00%> (-40.00%)` | :arrow_down: |
| [internal/mux/endpoint.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-aW50ZXJuYWwvbXV4L2VuZHBvaW50Lmdv) | `22.22% <0.00%> (-38.89%)` | :arrow_down: |
| [sdpsemantics.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-c2Rwc2VtYW50aWNzLmdv) | `0.00% <0.00%> (-37.50%)` | :arrow_down: |
| [dtlsrole.go](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-ZHRsc3JvbGUuZ28=) | `68.96% <0.00%> (-31.04%)` | :arrow_down: |
| ... and [31 more](https://codecov.io/gh/pion/webrtc/pull/1800/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pion/webrtc/pull/1800?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pion/webrtc/pull/1800?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion). Last update [9d59da5...ed63b3b](https://codecov.io/gh/pion/webrtc/pull/1800?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion).

renovate[bot]: ### :warning: Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

:recycle: Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or 
 - the branch becomes conflicted, or
 - you check the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: go.sum

```
Command failed: docker run --rm --name=renovate_go --label=renovate_child -v "/mnt/renovate/gh/pion/webrtc":"/mnt/renovate/gh/pion/webrtc" -v "/tmp/renovate-cache":"/tmp/renovate-cache" -v "/tmp/renovate-cache/others/go":"/tmp/renovate-cache/others/go" -e GOPATH -e CGO_ENABLED -w "/mnt/renovate/gh/pion/webrtc" docker.io/renovate/go:1.13.15 bash -l -c "git config --global url.\"https://**redacted**@github.com/\".insteadOf \"https://github.com/\" && go get -d ./... && go mod tidy && go mod tidy"
go: finding golang.org/x/net e5908800b52b
go: downloading github.com/pion/rtp v1.6.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/logging v0.2.2
go: downloading github.com/pion/interceptor v0.0.12
go: downloading github.com/pion/transport v0.12.3
go: downloading github.com/pion/datachannel v1.4.21
go: extracting github.com/pion/rtp v1.6.2
go: downloading github.com/pion/dtls/v2 v2.0.9
go: extracting github.com/pion/randutil v0.1.0
go: downloading github.com/pion/sctp v1.7.12
go: downloading github.com/pion/sdp/v3 v3.0.4
go: extracting github.com/pion/interceptor v0.0.12
go: extracting github.com/pion/logging v0.2.2
go: downloading golang.org/x/net v0.0.0-20210502030024-e5908800b52b
go: extracting github.com/pion/datachannel v1.4.21
go: downloading github.com/pion/ice/v2 v2.1.7
go: downloading github.com/pion/rtcp v1.2.6
go: extracting github.com/pion/transport v0.12.3
go: extracting github.com/pion/sctp v1.7.12
go: downloading github.com/pion/srtp/v2 v2.0.2
go: extracting github.com/pion/sdp/v3 v3.0.4
go: extracting github.com/pion/rtcp v1.2.6
go: extracting github.com/pion/ice/v2 v2.1.7
go: extracting github.com/pion/srtp/v2 v2.0.2
go: extracting github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/pion/turn/v2 v2.0.5
go: downloading github.com/pion/stun v0.3.5
go: downloading github.com/pion/mdns v0.0.5
go: downloading github.com/google/uuid v1.2.0
go: downloading github.com/pion/udp v0.1.1
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: extracting github.com/pion/mdns v0.0.5
go: extracting github.com/pion/turn/v2 v2.0.5
go: extracting github.com/google/uuid v1.2.0
go: extracting github.com/pion/udp v0.1.1
go: extracting github.com/pion/stun v0.3.5
go: extracting golang.org/x/net v0.0.0-20210502030024-e5908800b52b
go: extracting golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: extracting golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/sclevine/agouti v3.0.0+incompatible
go: extracting github.com/stretchr/testify v1.7.0
go: extracting github.com/sclevine/agouti v3.0.0+incompatible
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/onsi/gomega v1.11.0
go: downloading github.com/onsi/ginkgo v1.16.1
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: extracting github.com/pmezard/go-difflib v1.0.0
go: extracting gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: extracting github.com/davecgh/go-spew v1.1.1
go: extracting github.com/onsi/gomega v1.11.0
go: extracting github.com/onsi/ginkgo v1.16.1
go: downloading golang.org/x/text v0.3.6
go: downloading gopkg.in/yaml.v2 v2.4.0
go: extracting gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading google.golang.org/protobuf v1.23.0
go: extracting github.com/nxadm/tail v1.4.8
go: extracting google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: extracting github.com/google/go-cmp v0.4.0
go: extracting gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: extracting github.com/fsnotify/fsnotify v1.4.9
go: extracting golang.org/x/text v0.3.6
github.com/pion/webrtc/v3 tested by
	github.com/pion/webrtc/v3.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200313102051-9f266ea9e77c: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/gomega imports
	github.com/onsi/gomega/matchers imports
	gopkg.in/yaml.v2: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v2@v2.4.0: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/ginkgo imports
	github.com/onsi/ginkgo/internal/remote imports
	github.com/nxadm/tail imports
	gopkg.in/tomb.v1: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/tomb.v1@v1.0.0-20141024135613-dd632973f1e7: permission denied

```


renovate[bot]: ### :warning: Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

:recycle: Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or 
 - the branch becomes conflicted, or
 - you check the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: go.sum

```
Command failed: docker run --rm --name=renovate_go --label=renovate_child -v "/mnt/renovate/gh/pion/webrtc":"/mnt/renovate/gh/pion/webrtc" -v "/tmp/renovate-cache":"/tmp/renovate-cache" -v "/tmp/renovate-cache/others/go":"/tmp/renovate-cache/others/go" -e GOPATH -e CGO_ENABLED -w "/mnt/renovate/gh/pion/webrtc" docker.io/renovate/go:1.13.15 bash -l -c "git config --global url.\"https://**redacted**@github.com/\".insteadOf \"https://github.com/\" && go get -d ./... && go mod tidy && go mod tidy"
go: finding golang.org/x/net bbd867fde50d
go: downloading github.com/pion/rtp v1.6.2
go: downloading github.com/pion/logging v0.2.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/interceptor v0.0.12
go: downloading github.com/pion/transport v0.12.3
go: extracting github.com/pion/randutil v0.1.0
go: downloading golang.org/x/net v0.0.0-20210504132125-bbd867fde50d
go: downloading github.com/pion/srtp/v2 v2.0.2
go: downloading github.com/pion/dtls/v2 v2.0.9
go: extracting github.com/pion/transport v0.12.3
go: extracting github.com/pion/logging v0.2.2
go: downloading github.com/pion/ice/v2 v2.1.7
go: extracting github.com/pion/interceptor v0.0.12
go: extracting github.com/pion/rtp v1.6.2
go: downloading github.com/pion/datachannel v1.4.21
go: extracting github.com/pion/srtp/v2 v2.0.2
go: downloading github.com/pion/sdp/v3 v3.0.4
go: downloading github.com/pion/sctp v1.7.12
go: downloading github.com/pion/rtcp v1.2.6
go: extracting github.com/pion/ice/v2 v2.1.7
go: extracting github.com/pion/datachannel v1.4.21
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/pion/turn/v2 v2.0.5
go: extracting github.com/pion/sctp v1.7.12
go: extracting github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/google/uuid v1.2.0
go: extracting github.com/pion/rtcp v1.2.6
go: downloading github.com/pion/mdns v0.0.5
go: extracting github.com/pkg/errors v0.9.1
go: downloading github.com/pion/stun v0.3.5
go: extracting github.com/pion/sdp/v3 v3.0.4
go: extracting github.com/pion/mdns v0.0.5
go: extracting github.com/pion/turn/v2 v2.0.5
go: extracting github.com/google/uuid v1.2.0
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: extracting github.com/pion/stun v0.3.5
go: downloading github.com/pion/udp v0.1.1
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: extracting github.com/pion/udp v0.1.1
go: extracting golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: extracting golang.org/x/net v0.0.0-20210504132125-bbd867fde50d
go: extracting golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: extracting golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/sclevine/agouti v3.0.0+incompatible
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: extracting gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: extracting github.com/sclevine/agouti v3.0.0+incompatible
go: downloading github.com/onsi/gomega v1.11.0
go: downloading github.com/onsi/ginkgo v1.16.1
go: extracting github.com/onsi/gomega v1.11.0
go: extracting github.com/onsi/ginkgo v1.16.1
go: downloading golang.org/x/text v0.3.6
go: downloading gopkg.in/yaml.v2 v2.4.0
go: extracting gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading github.com/golang/protobuf v1.4.3
go: extracting github.com/nxadm/tail v1.4.8
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: extracting gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: extracting github.com/golang/protobuf v1.4.3
go: extracting github.com/fsnotify/fsnotify v1.4.9
go: downloading google.golang.org/protobuf v1.23.0
go: extracting google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
go: extracting github.com/google/go-cmp v0.4.0
go: extracting golang.org/x/text v0.3.6
github.com/pion/webrtc/v3 tested by
	github.com/pion/webrtc/v3.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200313102051-9f266ea9e77c: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/gomega imports
	github.com/onsi/gomega/matchers imports
	gopkg.in/yaml.v2: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v2@v2.4.0: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/ginkgo imports
	github.com/onsi/ginkgo/internal/remote imports
	github.com/nxadm/tail imports
	gopkg.in/tomb.v1: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/tomb.v1@v1.0.0-20141024135613-dd632973f1e7: permission denied

```


renovate[bot]: ### :warning: Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

:recycle: Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or 
 - the branch becomes conflicted, or
 - you check the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: go.sum

```
Command failed: docker run --rm --name=renovate_go --label=renovate_child -v "/mnt/renovate/gh/pion/webrtc":"/mnt/renovate/gh/pion/webrtc" -v "/tmp/renovate-cache":"/tmp/renovate-cache" -v "/tmp/renovate-cache/others/go":"/tmp/renovate-cache/others/go" -e GOPATH -e CGO_ENABLED -w "/mnt/renovate/gh/pion/webrtc" docker.io/renovate/go:1.16.3 bash -l -c "git config --global url.\"https://**redacted**@github.com/\".insteadOf \"https://github.com/\" && go get -d ./... && go mod tidy && go mod tidy"
go: downloading github.com/pion/datachannel v1.4.21
go: downloading github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/pion/ice/v2 v2.1.7
go: downloading github.com/pion/interceptor v0.0.12
go: downloading github.com/pion/logging v0.2.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/rtcp v1.2.6
go: downloading github.com/pion/rtp v1.6.2
go: downloading github.com/pion/sctp v1.7.12
go: downloading github.com/pion/sdp/v3 v3.0.4
go: downloading github.com/pion/srtp/v2 v2.0.2
go: downloading github.com/pion/transport v0.12.3
go: downloading golang.org/x/net v0.0.0-20210505024714-0287a6fb4125
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/pion/udp v0.1.1
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/google/uuid v1.2.0
go: downloading github.com/pion/mdns v0.0.5
go: downloading github.com/pion/stun v0.3.5
go: downloading github.com/pion/turn/v2 v2.0.5
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/sclevine/agouti v3.0.0+incompatible
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: downloading github.com/onsi/ginkgo v1.16.1
go: downloading github.com/onsi/gomega v1.11.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading golang.org/x/text v0.3.6
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/golang/protobuf v1.4.3
go: downloading google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
github.com/pion/webrtc/v3 tested by
	github.com/pion/webrtc/v3.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200313102051-9f266ea9e77c: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/gomega imports
	github.com/onsi/gomega/matchers imports
	gopkg.in/yaml.v2: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v2@v2.4.0: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/ginkgo imports
	github.com/onsi/ginkgo/internal/remote imports
	github.com/nxadm/tail imports
	gopkg.in/tomb.v1: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/tomb.v1@v1.0.0-20141024135613-dd632973f1e7: permission denied

```


renovate[bot]: ### :warning: Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

:recycle: Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or 
 - the branch becomes conflicted, or
 - you check the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: go.sum

```
Command failed: docker run --rm --name=renovate_go --label=renovate_child -v "/mnt/renovate/gh/pion/webrtc":"/mnt/renovate/gh/pion/webrtc" -v "/tmp/renovate-cache":"/tmp/renovate-cache" -v "/tmp/renovate-cache/others/go":"/tmp/renovate-cache/others/go" -e GOPATH -e CGO_ENABLED -w "/mnt/renovate/gh/pion/webrtc" docker.io/renovate/go:1.16.3 bash -l -c "git config --global url.\"https://**redacted**@github.com/\".insteadOf \"https://github.com/\" && go get -d ./... && go mod tidy && go mod tidy"
go: downloading github.com/pion/datachannel v1.4.21
go: downloading github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/pion/ice/v2 v2.1.7
go: downloading github.com/pion/interceptor v0.0.12
go: downloading github.com/pion/logging v0.2.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/rtcp v1.2.6
go: downloading github.com/pion/rtp v1.6.5
go: downloading github.com/pion/sctp v1.7.12
go: downloading github.com/pion/sdp/v3 v3.0.4
go: downloading github.com/pion/srtp/v2 v2.0.2
go: downloading github.com/pion/transport v0.12.3
go: downloading golang.org/x/net v0.0.0-20210505214959-0714010a04ed
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/pion/udp v0.1.1
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/google/uuid v1.2.0
go: downloading github.com/pion/mdns v0.0.5
go: downloading github.com/pion/stun v0.3.5
go: downloading github.com/pion/turn/v2 v2.0.5
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/sclevine/agouti v3.0.0+incompatible
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: downloading github.com/onsi/ginkgo v1.16.1
go: downloading github.com/onsi/gomega v1.11.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading golang.org/x/text v0.3.6
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/golang/protobuf v1.4.3
go: downloading google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
github.com/pion/webrtc/v3 tested by
	github.com/pion/webrtc/v3.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200313102051-9f266ea9e77c: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/gomega imports
	github.com/onsi/gomega/matchers imports
	gopkg.in/yaml.v2: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v2@v2.4.0: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/ginkgo imports
	github.com/onsi/ginkgo/internal/remote imports
	github.com/nxadm/tail imports
	gopkg.in/tomb.v1: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/tomb.v1@v1.0.0-20141024135613-dd632973f1e7: permission denied

```


renovate[bot]: ### ⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻️ Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or 
 - the branch becomes conflicted, or
 - you check the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: go.sum

```
Command failed: docker run --rm --name=renovate_go --label=renovate_child -v "/mnt/renovate/gh/pion/webrtc":"/mnt/renovate/gh/pion/webrtc" -v "/tmp/renovate-cache":"/tmp/renovate-cache" -v "/tmp/renovate-cache/others/go":"/tmp/renovate-cache/others/go" -e GOPATH -e CGO_ENABLED -w "/mnt/renovate/gh/pion/webrtc" docker.io/renovate/go:1.16.3 bash -l -c "git config --global url.\"https://**redacted**@github.com/\".insteadOf \"https://github.com/\" && go get -d ./... && go mod tidy && go mod tidy"
go: downloading github.com/pion/datachannel v1.4.21
go: downloading github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/pion/ice/v2 v2.1.7
go: downloading github.com/pion/interceptor v0.0.12
go: downloading github.com/pion/logging v0.2.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/rtcp v1.2.6
go: downloading github.com/pion/rtp v1.6.5
go: downloading github.com/pion/sctp v1.7.12
go: downloading github.com/pion/sdp/v3 v3.0.4
go: downloading github.com/pion/srtp/v2 v2.0.2
go: downloading github.com/pion/transport v0.12.3
go: downloading golang.org/x/net v0.0.0-20210505214959-0714010a04ed
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/pion/udp v0.1.1
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/google/uuid v1.2.0
go: downloading github.com/pion/mdns v0.0.5
go: downloading github.com/pion/stun v0.3.5
go: downloading github.com/pion/turn/v2 v2.0.5
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/sclevine/agouti v3.0.0+incompatible
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: downloading github.com/onsi/ginkgo v1.16.1
go: downloading github.com/onsi/gomega v1.11.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading golang.org/x/text v0.3.6
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/golang/protobuf v1.4.3
go: downloading google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
github.com/pion/webrtc/v3 tested by
	github.com/pion/webrtc/v3.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200313102051-9f266ea9e77c: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/gomega imports
	github.com/onsi/gomega/matchers imports
	gopkg.in/yaml.v2: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v2@v2.4.0: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/ginkgo imports
	github.com/onsi/ginkgo/internal/remote imports
	github.com/nxadm/tail imports
	gopkg.in/tomb.v1: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/tomb.v1@v1.0.0-20141024135613-dd632973f1e7: permission denied

```


renovate[bot]: ### ⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻️ Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or 
 - the branch becomes conflicted, or
 - you check the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: go.sum

```
Command failed: docker run --rm --name=renovate_go --label=renovate_child -v "/mnt/renovate/gh/pion/webrtc":"/mnt/renovate/gh/pion/webrtc" -v "/tmp/renovate-cache":"/tmp/renovate-cache" -v "/tmp/renovate-cache/others/go":"/tmp/renovate-cache/others/go" -e GOPATH -e CGO_ENABLED -w "/mnt/renovate/gh/pion/webrtc" docker.io/renovate/go:1.16.3 bash -l -c "git config --global url.\"https://**redacted**@github.com/\".insteadOf \"https://github.com/\" && go get -d ./... && go mod tidy && go mod tidy"
go: downloading github.com/pion/datachannel v1.4.21
go: downloading github.com/pion/dtls/v2 v2.0.9
go: downloading github.com/pion/ice/v2 v2.1.7
go: downloading github.com/pion/interceptor v0.0.12
go: downloading github.com/pion/logging v0.2.2
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/rtcp v1.2.6
go: downloading github.com/pion/rtp v1.6.5
go: downloading github.com/pion/sctp v1.7.12
go: downloading github.com/pion/sdp/v3 v3.0.4
go: downloading github.com/pion/srtp/v2 v2.0.2
go: downloading github.com/pion/transport v0.12.3
go: downloading golang.org/x/net v0.0.0-20210510095157-81045d8b478c
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/pion/udp v0.1.1
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/google/uuid v1.2.0
go: downloading github.com/pion/mdns v0.0.5
go: downloading github.com/pion/stun v0.3.5
go: downloading github.com/pion/turn/v2 v2.0.5
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading golang.org/x/sys v0.0.0-20210423082822-04245dca01da
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/sclevine/agouti v3.0.0+incompatible
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: downloading github.com/onsi/ginkgo v1.16.1
go: downloading github.com/onsi/gomega v1.11.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading golang.org/x/text v0.3.6
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/golang/protobuf v1.4.3
go: downloading google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
github.com/pion/webrtc/v3 tested by
	github.com/pion/webrtc/v3.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200313102051-9f266ea9e77c: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/gomega imports
	github.com/onsi/gomega/matchers imports
	gopkg.in/yaml.v2: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/yaml.v2@v2.4.0: permission denied
github.com/pion/webrtc/v3/e2e tested by
	github.com/pion/webrtc/v3/e2e.test imports
	github.com/sclevine/agouti tested by
	github.com/sclevine/agouti.test imports
	github.com/onsi/ginkgo imports
	github.com/onsi/ginkgo/internal/remote imports
	github.com/nxadm/tail imports
	gopkg.in/tomb.v1: fstatat /tmp/renovate-cache/others/go/pkg/mod/gopkg.in/tomb.v1@v1.0.0-20141024135613-dd632973f1e7: permission denied

```



Patch:
diff --git a/errors.go b/errors.go
index 23d26200..31595b59 100644
--- a/errors.go
+++ b/errors.go
@@ -202,6 +202,7 @@ var (
 
 	errRTPTransceiverCannotChangeMid        = errors.New("errRTPSenderTrackNil")
 	errRTPTransceiverSetSendingInvalidState = errors.New("invalid state change in RTPTransceiver.setSending")
+	errRTPTransceiverCodecUnsupported       = errors.New("unsupported codec type by this transceiver")
 
 	errSCTPTransportDTLS = errors.New("DTLS not established")
 
diff --git a/go.mod b/go.mod
index aaa72b12..919b7cad 100644
--- a/go.mod
+++ b/go.mod
@@ -19,5 +19,5 @@ require (
 	github.com/pion/transport v0.12.3
 	github.com/sclevine/agouti v3.0.0+incompatible
 	github.com/stretchr/testify v1.7.0
-	golang.org/x/net v0.0.0-20210420210106-798c2154c571
+	golang.org/x/net v0.0.0-20210614182718-04defd469f4e
 )
diff --git a/go.sum b/go.sum
index fcccc0b3..1ba79cb9 100644
--- a/go.sum
+++ b/go.sum
@@ -102,8 +102,8 @@ golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwY
 golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
 golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
-golang.org/x/net v0.0.0-20210420210106-798c2154c571 h1:Q6Bg8xzKzpFPU4Oi1sBnBTHBwlMsLeEXpu4hYBY8rAg=
-golang.org/x/net v0.0.0-20210420210106-798c2154c571/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
+golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
+golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -118,8 +118,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe h1:WdX7u8s3yOigWAhHEaDl8r9G+4XwFQEQFtBMYyN+kXQ=
-golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
diff --git a/mediaengine.go b/mediaengine.go
index c7384fe4..6c160358 100644
--- a/mediaengine.go
+++ b/mediaengine.go
@@ -6,6 +6,7 @@ import (
 	"fmt"
 	"strconv"
 	"strings"
+	"sync"
 	"time"
 
 	"github.com/pion/rtp"
@@ -57,6 +58,8 @@ type MediaEngine struct {
 
 	headerExtensions           []mediaEngineHeaderExtension
 	negotiatedHeaderExtensions map[int]mediaEngineHeaderExtension
+
+	mu sync.RWMutex
 }
 
 // RegisterDefaultCodecs registers the default codecs supported by Pion WebRTC.
@@ -196,6 +199,9 @@ func (m *MediaEngine) addCodec(codecs []RTPCodecParameters, codec RTPCodecParame
 // These are the list of codecs supported by this PeerConnection.
 // RegisterCodec is not safe for concurrent use.
 func (m *MediaEngine) RegisterCodec(codec RTPCodecParameters, typ RTPCodecType) error {
+	m.mu.Lock()
+	defer m.mu.Unlock()
+
 	codec.statsID = fmt.Sprintf("RTPCodec-%d", time.Now().UnixNano())
 	switch typ {
 	case RTPCodecTypeAudio:
@@ -211,6 +217,9 @@ func (m *MediaEngine) RegisterCodec(codec RTPCodecParameters, typ RTPCodecType)
 // RegisterHeaderExtension adds a header extension to the MediaEngine
 // To determine the negotiated value use `GetHeaderExtensionID` after signaling is complete
 func (m *MediaEngine) RegisterHeaderExtension(extension RTPHeaderExtensionCapability, typ RTPCodecType, allowedDirections ...RTPTransceiverDirection) error {
+	m.mu.Lock()
+	defer m.mu.Unlock()
+
 	if m.negotiatedHeaderExtensions == nil {
 		m.negotiatedHeaderExtensions = map[int]mediaEngineHeaderExtension{}
 	}
@@ -251,6 +260,9 @@ func (m *MediaEngine) RegisterHeaderExtension(extension RTPHeaderExtensionCapabi
 
 // RegisterFeedback adds feedback mechanism to already registered codecs.
 func (m *MediaEngine) RegisterFeedback(feedback RTCPFeedback, typ RTPCodecType) {
+	m.mu.Lock()
+	defer m.mu.Unlock()
+
 	switch typ {
 	case RTPCodecTypeVideo:
 		for i, v := range m.videoCodecs {
@@ -268,6 +280,9 @@ func (m *MediaEngine) RegisterFeedback(feedback RTCPFeedback, typ RTPCodecType)
 // getHeaderExtensionID returns the negotiated ID for a header extension.
 // If the Header Extension isn't enabled ok will be false
 func (m *MediaEngine) getHeaderExtensionID(extension RTPHeaderExtensionCapability) (val int, audioNegotiated, videoNegotiated bool) {
+	m.mu.RLock()
+	defer m.mu.RUnlock()
+
 	if m.negotiatedHeaderExtensions == nil {
 		return 0, false, false
 	}
@@ -284,6 +299,8 @@ func (m *MediaEngine) getHeaderExtensionID(extension RTPHeaderExtensionCapabilit
 // copy copies any user modifiable state of the MediaEngine
 // all internal state is reset
 func (m *MediaEngine) copy() *MediaEngine {
+	m.mu.Lock()
+	defer m.mu.Unlock()
 	cloned := &MediaEngine{
 		videoCodecs:      append([]RTPCodecParameters{}, m.videoCodecs...),
 		audioCodecs:      append([]RTPCodecParameters{}, m.audioCodecs...),
@@ -296,12 +313,24 @@ func (m *MediaEngine) copy() *MediaEngine {
 }
 
 func (m *MediaEngine) getCodecByPayload(payloadType PayloadType) (RTPCodecParameters, RTPCodecType, error) {
-	for _, codec := range m.negotiatedVideoCodecs {
+	m.mu.RLock()
+	defer m.mu.RUnlock()
+
+	codecs := m.negotiatedVideoCodecs
+	if !m.negotiatedVideo {
+		codecs = m.videoCodecs
+	}
+	for _, codec := range codecs {
 		if codec.PayloadType == payloadType {
 			return codec, RTPCodecTypeVideo, nil
 		}
 	}
-	for _, codec := range m.negotiatedAudioCodecs {
+
+	codecs = m.negotiatedAudioCodecs
+	if !m.negotiatedAudio {
+		codecs = m.audioCodecs
+	}
+	for _, codec := range codecs {
 		if codec.PayloadType == payloadType {
 			return codec, RTPCodecTypeAudio, nil
 		}
@@ -311,6 +340,9 @@ func (m *MediaEngine) getCodecByPayload(payloadType PayloadType) (RTPCodecParame
 }
 
 func (m *MediaEngine) collectStats(collector *statsReportCollector) {
+	m.mu.RLock()
+	defer m.mu.RUnlock()
+
 	statsLoop := func(codecs []RTPCodecParameters) {
 		for _, codec := range codecs {
 			collector.Collecting()
@@ -418,6 +450,9 @@ func (m *MediaEngine) pushCodecs(codecs []RTPCodecParameters, typ RTPCodecType)
 
 // Update the MediaEngine from a remote description
 func (m *MediaEngine) updateFromRemoteDescription(desc sdp.SessionDescription) error {
+	m.mu.Lock()
+	defer m.mu.Unlock()
+
 	for _, media := range desc.MediaDescriptions {
 		var typ RTPCodecType
 		switch {
@@ -478,6 +513,9 @@ func (m *MediaEngine) updateFromRemoteDescription(desc sdp.SessionDescription) e
 }
 
 func (m *MediaEngine) getCodecsByKind(typ RTPCodecType) []RTPCodecParameters {
+	m.mu.RLock()
+	defer m.mu.RUnlock()
+
 	if typ == RTPCodecTypeVideo {
 		if m.negotiatedVideo {
 			return m.negotiatedVideoCodecs
@@ -496,6 +534,9 @@ func (m *MediaEngine) getCodecsByKind(typ RTPCodecType) []RTPCodecParameters {
 }
 
 func (m *MediaEngine) getRTPParametersByKind(typ RTPCodecType, directions []RTPTransceiverDirection) RTPParameters {
+	m.mu.RLock()
+	defer m.mu.RUnlock()
+
 	headerExtensions := make([]RTPHeaderExtensionParameter, 0)
 
 	if m.negotiatedVideo && typ == RTPCodecTypeVideo ||
@@ -525,6 +566,8 @@ func (m *MediaEngine) getRTPParametersByPayloadType(payloadType PayloadType) (RT
 		return RTPParameters{}, err
 	}
 
+	m.mu.RLock()
+	defer m.mu.RUnlock()
 	headerExtensions := make([]RTPHeaderExtensionParameter, 0)
 	for id, e := range m.negotiatedHeaderExtensions {
 		if e.isAudio && typ == RTPCodecTypeAudio || e.isVideo && typ == RTPCodecTypeVideo {
diff --git a/peerconnection.go b/peerconnection.go
index 1afb120c..8ac7ec61 100644
--- a/peerconnection.go
+++ b/peerconnection.go
@@ -1052,7 +1052,7 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error {
 					localDirection = RTPTransceiverDirectionSendonly
 				}
 
-				t = newRTPTransceiver(receiver, nil, localDirection, kind)
+				t = newRTPTransceiver(receiver, nil, localDirection, kind, pc.api)
 				pc.mu.Lock()
 				pc.addRTPTransceiver(t)
 				pc.mu.Unlock()
@@ -1634,7 +1634,7 @@ func (pc *PeerConnection) newTransceiverFromTrack(direction RTPTransceiverDirect
 	if err != nil {
 		return
 	}
-	return newRTPTransceiver(r, s, direction, track.Kind()), nil
+	return newRTPTransceiver(r, s, direction, track.Kind(), pc.api), nil
 }
 
 // AddTransceiverFromKind Create a new RtpTransceiver and adds it to the set of transceivers.
@@ -1668,7 +1668,7 @@ func (pc *PeerConnection) AddTransceiverFromKind(kind RTPCodecType, init ...RTPT
 		if err != nil {
 			return nil, err
 		}
-		t = newRTPTransceiver(receiver, nil, RTPTransceiverDirectionRecvonly, kind)
+		t = newRTPTransceiver(receiver, nil, RTPTransceiverDirectionRecvonly, kind, pc.api)
 	default:
 		return nil, errPeerConnAddTransceiverFromKindSupport
 	}
@@ -2208,7 +2208,7 @@ func (pc *PeerConnection) generateMatchedSDP(transceivers []*RTPTransceiver, use
 				t, localTransceivers = satisfyTypeAndDirection(kind, direction, localTransceivers)
 				if t == nil {
 					if len(mediaTransceivers) == 0 {
-						t = &RTPTransceiver{kind: kind}
+						t = &RTPTransceiver{kind: kind, api: pc.api, codecs: pc.api.mediaEngine.getCodecsByKind(kind)}
 						t.setDirection(RTPTransceiverDirectionInactive)
 						mediaTransceivers = append(mediaTransceivers, t)
 					}
diff --git a/rtpreceiver.go b/rtpreceiver.go
index 446e8ae9..cec59339 100644
--- a/rtpreceiver.go
+++ b/rtpreceiver.go
@@ -38,6 +38,8 @@ type RTPReceiver struct {
 	closed, received chan interface{}
 	mu               sync.RWMutex
 
+	tr *RTPTransceiver
+
 	// A reference to the associated api object
 	api *API
 }
@@ -60,6 +62,12 @@ func (api *API) NewRTPReceiver(kind RTPCodecType, transport *DTLSTransport) (*RT
 	return r, nil
 }
 
+func (r *RTPReceiver) setRTPTransceiver(tr *RTPTransceiver) {
+	r.mu.Lock()
+	defer r.mu.Unlock()
+	r.tr = tr
+}
+
 // Transport returns the currently-configured *DTLSTransport or nil
 // if one has not yet been configured
 func (r *RTPReceiver) Transport() *DTLSTransport {
@@ -68,10 +76,18 @@ func (r *RTPReceiver) Transport() *DTLSTransport {
 	return r.transport
 }
 
+func (r *RTPReceiver) getParameters() RTPParameters {
+	parameters := r.api.mediaEngine.getRTPParametersByKind(r.kind, []RTPTransceiverDirection{RTPTransceiverDirectionRecvonly})
+	parameters.Codecs = r.tr.getCodecs()
+	return parameters
+}
+
 // GetParameters describes the current configuration for the encoding and
 // transmission of media on the receiver's track.
 func (r *RTPReceiver) GetParameters() RTPParameters {
-	return r.api.mediaEngine.getRTPParametersByKind(r.kind, []RTPTransceiverDirection{RTPTransceiverDirectionRecvonly})
+	r.mu.RLock()
+	defer r.mu.RUnlock()
+	return r.getParameters()
 }
 
 // Track returns the RtpTransceiver TrackRemote
@@ -119,7 +135,7 @@ func (r *RTPReceiver) Receive(parameters RTPReceiveParameters) error {
 			),
 		}
 
-		globalParams := r.GetParameters()
+		globalParams := r.getParameters()
 		codec := RTPCodecCapability{}
 		if len(globalParams.Codecs) != 0 {
 			codec = globalParams.Codecs[0].RTPCodecCapability
diff --git a/rtpsender.go b/rtpsender.go
index fb21d1bd..96cb926a 100644
--- a/rtpsender.go
+++ b/rtpsender.go
@@ -38,6 +38,8 @@ type RTPSender struct {
 	api *API
 	id  string
 
+	tr *RTPTransceiver
+
 	mu                     sync.RWMutex
 	sendCalled, stopCalled chan struct{}
 }
@@ -88,6 +90,12 @@ func (r *RTPSender) setNegotiated() {
 	r.negotiated = true
 }
 
+func (r *RTPSender) setRTPTransceiver(tr *RTPTransceiver) {
+	r.mu.Lock()
+	defer r.mu.Unlock()
+	r.tr = tr
+}
+
 // Transport returns the currently-configured *DTLSTransport or nil
 // if one has not yet been configured
 func (r *RTPSender) Transport() *DTLSTransport {
@@ -99,7 +107,7 @@ func (r *RTPSender) Transport() *DTLSTransport {
 // GetParameters describes the current configuration for the encoding and
 // transmission of media on the sender's track.
 func (r *RTPSender) GetParameters() RTPSendParameters {
-	return RTPSendParameters{
+	sendParameters := RTPSendParameters{
 		RTPParameters: r.api.mediaEngine.getRTPParametersByKind(
 			r.track.Kind(),
 			[]RTPTransceiverDirection{RTPTransceiverDirectionSendonly},
@@ -113,6 +121,8 @@ func (r *RTPSender) GetParameters() RTPSendParameters {
 			},
 		},
 	}
+	sendParameters.Codecs = r.tr.getCodecs()
+	return sendParameters
 }
 
 // Track returns the RTCRtpTransceiver track, or nil
diff --git a/rtptransceiver.go b/rtptransceiver.go
index 62291565..4d21b545 100644
--- a/rtptransceiver.go
+++ b/rtptransceiver.go
@@ -4,6 +4,7 @@ package webrtc
 
 import (
 	"fmt"
+	"sync"
 	"sync/atomic"
 
 	"github.com/pion/rtp"
@@ -16,8 +17,13 @@ type RTPTransceiver struct {
 	receiver  atomic.Value // *RTPReceiver
 	direction atomic.Value // RTPTransceiverDirection
 
+	codecs []RTPCodecParameters // User provided codecs via SetCodecPreferences
+
 	stopped bool
 	kind    RTPCodecType
+
+	api *API
+	mu  sync.RWMutex
 }
 
 func newRTPTransceiver(
@@ -25,14 +31,51 @@ func newRTPTransceiver(
 	sender *RTPSender,
 	direction RTPTransceiverDirection,
 	kind RTPCodecType,
+	api *API,
 ) *RTPTransceiver {
-	t := &RTPTransceiver{kind: kind}
+	t := &RTPTransceiver{kind: kind, api: api}
 	t.setReceiver(receiver)
 	t.setSender(sender)
 	t.setDirection(direction)
 	return t
 }
 
+// SetCodecPreferences sets preferred list of supported codecs
+// if codecs is empty or nil we reset to default from MediaEngine
+func (t *RTPTransceiver) SetCodecPreferences(codecs []RTPCodecParameters) error {
+	t.mu.Lock()
+	defer t.mu.Unlock()
+
+	for _, codec := range codecs {
+		if _, matchType := codecParametersFuzzySearch(codec, t.api.mediaEngine.getCodecsByKind(t.kind)); matchType == codecMatchNone {
+			return fmt.Errorf("%w %s", errRTPTransceiverCodecUnsupported, codec.MimeType)
+		}
+	}
+
+	t.codecs = codecs
+	return nil
+}
+
+// Codecs returns list of supported codecs
+func (t *RTPTransceiver) getCodecs() []RTPCodecParameters {
+	t.mu.RLock()
+	defer t.mu.RUnlock()
+
+	mediaEngineCodecs := t.api.mediaEngine.getCodecsByKind(t.kind)
+	if len(t.codecs) == 0 {
+		return mediaEngineCodecs
+	}
+
+	filteredCodecs := []RTPCodecParameters{}
+	for _, codec := range t.codecs {
+		if c, matchType := codecParametersFuzzySearch(codec, mediaEngineCodecs); matchType != codecMatchNone {
+			filteredCodecs = append(filteredCodecs, c)
+		}
+	}
+
+	return filteredCodecs
+}
+
 // Sender returns the RTPTransceiver's RTPSender if it has one
 func (t *RTPTransceiver) Sender() *RTPSender {
 	if v := t.sender.Load(); v != nil {
@@ -49,6 +92,14 @@ func (t *RTPTransceiver) SetSender(s *RTPSender, track TrackLocal) error {
 }
 
 func (t *RTPTransceiver) setSender(s *RTPSender) {
+	if s != nil {
+		s.setRTPTransceiver(t)
+	}
+
+	if prevSender := t.Sender(); prevSender != nil {
+		prevSender.setRTPTransceiver(nil)
+	}
+
 	t.sender.Store(s)
 }
 
@@ -106,6 +157,14 @@ func (t *RTPTransceiver) Stop() error {
 }
 
 func (t *RTPTransceiver) setReceiver(r *RTPReceiver) {
+	if r != nil {
+		r.setRTPTransceiver(t)
+	}
+
+	if prevReceiver := t.Receiver(); prevReceiver != nil {
+		prevReceiver.setRTPTransceiver(nil)
+	}
+
 	t.receiver.Store(r)
 }
 
diff --git a/sdp.go b/sdp.go
index af4c3646..8aca0041 100644
--- a/sdp.go
+++ b/sdp.go
@@ -292,7 +292,7 @@ func addTransceiverSDP(d *sdp.SessionDescription, isPlanB, shouldAddCandidates b
 		WithPropertyAttribute(sdp.AttrKeyRTCPMux).
 		WithPropertyAttribute(sdp.AttrKeyRTCPRsize)
 
-	codecs := mediaEngine.getCodecsByKind(t.kind)
+	codecs := t.getCodecs()
 	for _, codec := range codecs {
 		name := strings.TrimPrefix(codec.MimeType, "audio/")
 		name = strings.TrimPrefix(name, "video/")


Test patch:
diff --git a/rtptransceiver_test.go b/rtptransceiver_test.go
new file mode 100644
index 00000000..f5d46337
--- /dev/null
+++ b/rtptransceiver_test.go
@@ -0,0 +1,133 @@
+// +build !js
+
+package webrtc
+
+import (
+	"strings"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func Test_RTPTransceiver_SetCodecPreferences(t *testing.T) {
+	me := &MediaEngine{}
+	api := NewAPI(WithMediaEngine(me))
+	assert.NoError(t, me.RegisterDefaultCodecs())
+
+	me.pushCodecs(me.videoCodecs, RTPCodecTypeVideo)
+	me.pushCodecs(me.audioCodecs, RTPCodecTypeAudio)
+
+	tr := RTPTransceiver{kind: RTPCodecTypeVideo, api: api, codecs: me.videoCodecs}
+	assert.EqualValues(t, me.videoCodecs, tr.getCodecs())
+
+	failTestCases := [][]RTPCodecParameters{
+		{
+			{
+				RTPCodecCapability: RTPCodecCapability{MimeTypeOpus, 48000, 2, "minptime=10;useinbandfec=1", nil},
+				PayloadType:        111,
+			},
+		},
+		{
+			{
+				RTPCodecCapability: RTPCodecCapability{MimeTypeVP8, 90000, 0, "", nil},
+				PayloadType:        96,
+			},
+			{
+				RTPCodecCapability: RTPCodecCapability{MimeTypeOpus, 48000, 2, "minptime=10;useinbandfec=1", nil},
+				PayloadType:        111,
+			},
+		},
+	}
+
+	for _, testCase := range failTestCases {
+		assert.Error(t, tr.SetCodecPreferences(testCase), errRTPTransceiverCodecUnsupported)
+	}
+
+	successTestCases := [][]RTPCodecParameters{
+		{
+			{
+				RTPCodecCapability: RTPCodecCapability{MimeTypeVP8, 90000, 0, "", nil},
+				PayloadType:        96,
+			},
+		},
+		{
+			{
+				RTPCodecCapability: RTPCodecCapability{MimeTypeVP8, 90000, 0, "", nil},
+				PayloadType:        96,
+			},
+			{
+				RTPCodecCapability: RTPCodecCapability{"video/rtx", 90000, 0, "apt=96", nil},
+				PayloadType:        97,
+			},
+
+			{
+				RTPCodecCapability: RTPCodecCapability{MimeTypeVP9, 90000, 0, "profile-id=0", nil},
+				PayloadType:        98,
+			},
+			{
+				RTPCodecCapability: RTPCodecCapability{"video/rtx", 90000, 0, "apt=98", nil},
+				PayloadType:        99,
+			},
+		},
+	}
+
+	for _, testCase := range successTestCases {
+		assert.NoError(t, tr.SetCodecPreferences(testCase))
+	}
+
+	assert.NoError(t, tr.SetCodecPreferences(nil))
+	assert.NotEqual(t, 0, len(tr.getCodecs()))
+
+	assert.NoError(t, tr.SetCodecPreferences([]RTPCodecParameters{}))
+	assert.NotEqual(t, 0, len(tr.getCodecs()))
+}
+
+// Assert that SetCodecPreferences properly filters codecs and PayloadTypes are respected
+func Test_RTPTransceiver_SetCodecPreferences_PayloadType(t *testing.T) {
+	testCodec := RTPCodecParameters{
+		RTPCodecCapability: RTPCodecCapability{"video/testCodec", 90000, 0, "", nil},
+		PayloadType:        50,
+	}
+
+	m := &MediaEngine{}
+	assert.NoError(t, m.RegisterDefaultCodecs())
+
+	offerPC, err := NewAPI(WithMediaEngine(m)).NewPeerConnection(Configuration{})
+	assert.NoError(t, err)
+
+	assert.NoError(t, m.RegisterCodec(testCodec, RTPCodecTypeVideo))
+
+	answerPC, err := NewAPI(WithMediaEngine(m)).NewPeerConnection(Configuration{})
+	assert.NoError(t, err)
+
+	_, err = offerPC.AddTransceiverFromKind(RTPCodecTypeVideo)
+	assert.NoError(t, err)
+
+	answerTransceiver, err := answerPC.AddTransceiverFromKind(RTPCodecTypeVideo)
+	assert.NoError(t, err)
+
+	assert.NoError(t, answerTransceiver.SetCodecPreferences([]RTPCodecParameters{
+		testCodec,
+		{
+			RTPCodecCapability: RTPCodecCapability{MimeTypeVP8, 90000, 0, "", nil},
+			PayloadType:        51,
+		},
+	}))
+
+	offer, err := offerPC.CreateOffer(nil)
+	assert.NoError(t, err)
+
+	assert.NoError(t, offerPC.SetLocalDescription(offer))
+	assert.NoError(t, answerPC.SetRemoteDescription(offer))
+
+	answer, err := answerPC.CreateAnswer(nil)
+	assert.NoError(t, err)
+
+	// VP8 with proper PayloadType
+	assert.NotEqual(t, -1, strings.Index(answer.SDP, "a=rtpmap:96 VP8/90000"))
+
+	// testCodec is ignored since offerer doesn't support
+	assert.Equal(t, -1, strings.Index(answer.SDP, "testCodec"))
+
+	closePairNow(t, offerPC, answerPC)
+}
diff --git a/sdp_test.go b/sdp_test.go
index 7bed5081..7a657bba 100644
--- a/sdp_test.go
+++ b/sdp_test.go
@@ -307,6 +307,8 @@ func TestMediaDescriptionFingerprints(t *testing.T) {
 	engine := &MediaEngine{}
 	assert.NoError(t, engine.RegisterDefaultCodecs())
 
+	api := NewAPI(WithMediaEngine(engine))
+
 	sk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
 	assert.NoError(t, err)
 
@@ -317,13 +319,17 @@ func TestMediaDescriptionFingerprints(t *testing.T) {
 		{
 			id: "video",
 			transceivers: []*RTPTransceiver{{
-				kind: RTPCodecTypeVideo,
+				kind:   RTPCodecTypeVideo,
+				api:    api,
+				codecs: engine.getCodecsByKind(RTPCodecTypeVideo),
 			}},
 		},
 		{
 			id: "audio",
 			transceivers: []*RTPTransceiver{{
-				kind: RTPCodecTypeAudio,
+				kind:   RTPCodecTypeAudio,
+				api:    api,
+				codecs: engine.getCodecsByKind(RTPCodecTypeAudio),
 			}},
 		},
 		{
@@ -363,21 +369,22 @@ func TestMediaDescriptionFingerprints(t *testing.T) {
 
 func TestPopulateSDP(t *testing.T) {
 	t.Run("Rid", func(t *testing.T) {
-		tr := &RTPTransceiver{kind: RTPCodecTypeVideo}
+		se := SettingEngine{}
+
+		me := &MediaEngine{}
+		assert.NoError(t, me.RegisterDefaultCodecs())
+		api := NewAPI(WithMediaEngine(me))
+
+		tr := &RTPTransceiver{kind: RTPCodecTypeVideo, api: api, codecs: me.videoCodecs}
 		tr.setDirection(RTPTransceiverDirectionRecvonly)
 		ridMap := map[string]string{
 			"ridkey": "some",
 		}
 		mediaSections := []mediaSection{{id: "video", transceivers: []*RTPTransceiver{tr}, ridMap: ridMap}}
 
-		se := SettingEngine{}
-
-		m := MediaEngine{}
-		assert.NoError(t, m.RegisterDefaultCodecs())
-
 		d := &sdp.SessionDescription{}
 
-		offerSdp, err := populateSDP(d, false, []DTLSFingerprint{}, se.sdpMediaLevelFingerprints, se.candidates.ICELite, &m, connectionRoleFromDtlsRole(defaultDtlsRoleOffer), []ICECandidate{}, ICEParameters{}, mediaSections, ICEGatheringStateComplete)
+		offerSdp, err := populateSDP(d, false, []DTLSFingerprint{}, se.sdpMediaLevelFingerprints, se.candidates.ICELite, me, connectionRoleFromDtlsRole(defaultDtlsRoleOffer), []ICECandidate{}, ICEParameters{}, mediaSections, ICEGatheringStateComplete)
 		assert.Nil(t, err)
 
 		// Test contains rid map keys
@@ -397,6 +404,50 @@ func TestPopulateSDP(t *testing.T) {
 		}
 		assert.Equal(t, true, found, "Rid key should be present")
 	})
+	t.Run("SetCodecPreferences", func(t *testing.T) {
+		se := SettingEngine{}
+
+		me := &MediaEngine{}
+		assert.NoError(t, me.RegisterDefaultCodecs())
+		api := NewAPI(WithMediaEngine(me))
+		me.pushCodecs(me.videoCodecs, RTPCodecTypeVideo)
+		me.pushCodecs(me.audioCodecs, RTPCodecTypeAudio)
+
+		tr := &RTPTransceiver{kind: RTPCodecTypeVideo, api: api, codecs: me.videoCodecs}
+		tr.setDirection(RTPTransceiverDirectionRecvonly)
+		codecErr := tr.SetCodecPreferences([]RTPCodecParameters{
+			{
+				RTPCodecCapability: RTPCodecCapability{MimeTypeVP8, 90000, 0, "", nil},
+				PayloadType:        96,
+			},
+		})
+		assert.NoError(t, codecErr)
+
+		mediaSections := []mediaSection{{id: "video", transceivers: []*RTPTransceiver{tr}}}
+
+		d := &sdp.SessionDescription{}
+
+		offerSdp, err := populateSDP(d, false, []DTLSFingerprint{}, se.sdpMediaLevelFingerprints, se.candidates.ICELite, me, connectionRoleFromDtlsRole(defaultDtlsRoleOffer), []ICECandidate{}, ICEParameters{}, mediaSections, ICEGatheringStateComplete)
+		assert.Nil(t, err)
+
+		// Test codecs
+		foundVP8 := false
+		for _, desc := range offerSdp.MediaDescriptions {
+			if desc.MediaName.Media != "video" {
+				continue
+			}
+			for _, a := range desc.Attributes {
+				if strings.Contains(a.Key, "rtpmap") {
+					if a.Value == "98 VP9/90000" {
+						t.Fatal("vp9 should not be present in sdp")
+					} else if a.Value == "96 VP8/90000" {
+						foundVP8 = true
+					}
+				}
+			}
+		}
+		assert.Equal(t, true, foundVP8, "vp8 should be present in sdp")
+	})
 }
 
 func TestGetRIDs(t *testing.T) {