mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
webrtc: fix packet corruption when reading G711 (#5048)
Some checks failed
code_lint / go (push) Has been cancelled
code_lint / go_mod (push) Has been cancelled
code_lint / docs (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_e2e (push) Has been cancelled
Some checks failed
code_lint / go (push) Has been cancelled
code_lint / go_mod (push) Has been cancelled
code_lint / docs (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_e2e (push) Has been cancelled
when a reader is reading a G711 track, stream units are modified globally, affecting every other reader. This fixes the issue.
This commit is contained in:
parent
2690ef8e71
commit
691d7290fb
1 changed files with 13 additions and 2 deletions
|
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/bluenviron/mediamtx/internal/logger"
|
||||
"github.com/bluenviron/mediamtx/internal/stream"
|
||||
"github.com/bluenviron/mediamtx/internal/unit"
|
||||
"github.com/pion/rtp"
|
||||
"github.com/pion/webrtc/v4"
|
||||
)
|
||||
|
||||
|
|
@ -377,7 +378,12 @@ func setupAudioTrack(
|
|||
media,
|
||||
opusFormat,
|
||||
func(u unit.Unit) error {
|
||||
for _, pkt := range u.GetRTPPackets() {
|
||||
for _, orig := range u.GetRTPPackets() {
|
||||
pkt := &rtp.Packet{
|
||||
Header: orig.Header,
|
||||
Payload: orig.Payload,
|
||||
}
|
||||
|
||||
// recompute timestamp from scratch.
|
||||
// Chrome requires a precise timestamp that FFmpeg doesn't provide.
|
||||
pkt.Timestamp = curTimestamp
|
||||
|
|
@ -488,7 +494,12 @@ func setupAudioTrack(
|
|||
media,
|
||||
g711Format,
|
||||
func(u unit.Unit) error {
|
||||
for _, pkt := range u.GetRTPPackets() {
|
||||
for _, orig := range u.GetRTPPackets() {
|
||||
pkt := &rtp.Packet{
|
||||
Header: orig.Header,
|
||||
Payload: orig.Payload,
|
||||
}
|
||||
|
||||
// recompute timestamp from scratch.
|
||||
// Chrome requires a precise timestamp that FFmpeg doesn't provide.
|
||||
pkt.Timestamp = curTimestamp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue