Send silent frame for muted audio downtrack (#1385)

* Send silent frame for muted audio downtrack

* Don't drop audio packets on pub muted

* don't inject blank audio frames for muted track
This commit is contained in:
cnderrauber
2023-02-07 13:12:50 +08:00
committed by GitHub
parent 2851a8ac98
commit 0e699d6ed0
2 changed files with 65 additions and 32 deletions
+1 -7
View File
@@ -1462,6 +1462,7 @@ func (f *Forwarder) GetTranslationParams(extPkt *buffer.ExtPacket, layer int32)
defer f.lock.Unlock()
// Video: Do not drop on publisher mute to enable resume on publisher unmute without a key frame.
// Audio: Do not drop on publisher mute to ensure decoder does not get stuck at a noise frame.
if f.muted {
return &TranslationParams{
shouldDrop: true,
@@ -1470,13 +1471,6 @@ func (f *Forwarder) GetTranslationParams(extPkt *buffer.ExtPacket, layer int32)
switch f.kind {
case webrtc.RTPCodecTypeAudio:
// Audio: Blank frames are injected on publisher mute to ensure decoder does not get stuck at a noise frame. So, do not forward.
if f.pubMuted {
return &TranslationParams{
shouldDrop: true,
}, nil
}
return f.getTranslationParamsAudio(extPkt, layer)
case webrtc.RTPCodecTypeVideo:
return f.getTranslationParamsVideo(extPkt, layer)