## Problem and outcome Connection recovery and packet repair could leave stale pictures, missing sound or unreliable remote input. This maintenance release repairs media/route ownership, H.264 negotiation, voice forwarding and Windows input recovery, and makes shared mobile controls and popovers easier to use. ## Release notes **Piik, now in your pocket.** Piik App supports Android screen sharing, with touch controls for a friend's computer. **手机,也能开播。** Piik App 支持 Android 屏幕分享,也能用手机控制朋友的电脑。 ### English Piik v2.5.1 improves sharing recovery, voice playback and remote control, with clearer mobile controls. It keeps the existing 2.x compatibility baseline. - Improve H.264 selection and picture recovery after reconnecting, changing sources or recovering lost packets; keep a working share when a replacement source fails. - Keep audio and room voice continuous, and prevent duplicate sound when switching playback windows. - Improve Windows input recovery and release remote-control permissions when their connection ends. - Keep mobile controls together and popovers usable after layout changes or in short viewports. - Open the appropriate Android update download, including the Gitee ZIP containing the APK. Self-hosted SFU servers refresh public addresses for new connections without a restart. - Add macOS source-thumbnail support. Update the App and self-hosted site together to receive all fixes. Browser settings and existing room data are retained. ### 中文 Piik v2.5.1 改善分享恢复、语音播放与远程控制的稳定性,让手机操作更顺手,沿用现有 2.x 兼容基线。 - 改善 H.264 编码选择,以及重连、切换分享源和丢包后的画面恢复;新分享源切换失败时保留正常分享。 - 保持声音与房间语音连续,避免切换播放窗口时出现双重声音。 - 改善 Windows 输入恢复,并在连接结束时释放远程控制授权。 - 手机控件保持成组,浮层在布局变化或可见高度较小时仍可操作。 - Android 更新打开对应下载入口,Gitee 提供内含 APK 的 ZIP;自部署 SFU 为新连接刷新公网地址,无需重启服务。 - 补齐 macOS 选源缩略图支持。 请一起更新 App 与自部署站点,以获得全部修复。浏览器设置与已有房间数据保留。 ## Validation - Full frontend typecheck, test and production-build acceptance; current Windows App/Server packaging, extracted-file checks and exact served JavaScript verified locally. - Existing Go, vulnerability, native media and controlled-network results retained at their tested revisions. The final production delta from the fully checked candidate is the shared short-viewport popover correction. - The diagnostic report supplied for #502 informed the Windows input fixes. #500 sharing is confirmed working; its missing source previews are implemented. Original-device follow-up remains separate from this release's verified local fixes. ## Compatibility and scope Preserves the published 2.x Browser/server, Native control, capture and SQLite contracts. No 3.0 or iOS implementation or external contributor patch is included. Related: #500, #502, #510, #512.
78 lines
2.9 KiB
Go
78 lines
2.9 KiB
Go
package forwarding
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/pion/interceptor"
|
|
"github.com/pion/interceptor/pkg/nack"
|
|
"github.com/pion/rtp"
|
|
"github.com/pion/webrtc/v4"
|
|
)
|
|
|
|
// RegisterIngressInterceptors leaves video NACK generation to the forwarding
|
|
// buffer, which sees primary sequence numbers after RTX repair. Pion's wire
|
|
// reader cannot observe those repairs; its reports, TWCC and responder remain.
|
|
func RegisterIngressInterceptors(media *webrtc.MediaEngine, registry *interceptor.Registry) error {
|
|
return webrtc.RegisterDefaultInterceptorsWithOptions(media, registry,
|
|
webrtc.WithNackGeneratorOptions(nack.GeneratorStreamsFilter(func(info *interceptor.StreamInfo) bool {
|
|
if strings.HasPrefix(strings.ToLower(info.MimeType), "video/") {
|
|
return false
|
|
}
|
|
for _, feedback := range info.RTCPFeedback {
|
|
if feedback.Type == "nack" && feedback.Parameter == "" {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
})))
|
|
}
|
|
|
|
// Each outgoing connection offers one primary video codec and Opus (111).
|
|
// RTX keeps late repair outside the primary stream's SRTP replay window.
|
|
func registerVideoCodec(media *webrtc.MediaEngine, codec webrtc.RTPCodecParameters) error {
|
|
if err := media.RegisterCodec(codec, webrtc.RTPCodecTypeVideo); err != nil {
|
|
return err
|
|
}
|
|
repairPayload := webrtc.PayloadType(96)
|
|
if repairPayload == codec.PayloadType {
|
|
repairPayload++
|
|
}
|
|
return media.RegisterCodec(webrtc.RTPCodecParameters{
|
|
RTPCodecCapability: webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypeRTX,
|
|
ClockRate: codec.ClockRate, SDPFmtpLine: "apt=" + strconv.Itoa(int(codec.PayloadType))},
|
|
PayloadType: repairPayload,
|
|
}, webrtc.RTPCodecTypeVideo)
|
|
}
|
|
|
|
// ReadRTP restores repaired packets to the admitted primary track. Pion can
|
|
// queue RTX before RID admission initializes SSRC or the first primary read
|
|
// initializes PayloadType. Ordinary packets retain their wire identity checks.
|
|
func ReadRTP(track *webrtc.TrackRemote) (*rtp.Packet, interceptor.Attributes, error) {
|
|
packet, attributes, err := track.ReadRTP()
|
|
if err == nil && attributes.Get(webrtc.AttributeRtxPayloadType) != nil {
|
|
packet.PayloadType = uint8(track.Codec().PayloadType)
|
|
packet.SSRC = uint32(track.SSRC())
|
|
}
|
|
return packet, attributes, err
|
|
}
|
|
|
|
// WithRTX restricts a negotiated offer to one primary codec and its associated
|
|
// repair stream. Selecting a media codec must not discard packet-loss recovery.
|
|
func WithRTX(primary webrtc.RTPCodecParameters, negotiated []webrtc.RTPCodecParameters) []webrtc.RTPCodecParameters {
|
|
selected := []webrtc.RTPCodecParameters{primary}
|
|
for _, repair := range negotiated {
|
|
if !strings.EqualFold(repair.MimeType, webrtc.MimeTypeRTX) {
|
|
continue
|
|
}
|
|
for _, field := range strings.Split(repair.SDPFmtpLine, ";") {
|
|
key, value, _ := strings.Cut(strings.TrimSpace(field), "=")
|
|
if key == "apt" && strings.TrimSpace(value) == strconv.Itoa(int(primary.PayloadType)) {
|
|
selected = append(selected, repair)
|
|
break
|
|
}
|
|
}
|
|
}
|
|
return selected
|
|
}
|