From 40a9b74ea45a288b0275decdda71cadd20af954c Mon Sep 17 00:00:00 2001 From: dexter <178529795@qq.com> Date: Tue, 22 Mar 2022 09:22:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0publisher=E7=9A=84?= =?UTF-8?q?=E6=AF=94=E8=BE=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publisher.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/publisher.go b/publisher.go index 1a41391..d55dff8 100644 --- a/publisher.go +++ b/publisher.go @@ -29,10 +29,13 @@ func (p *Publisher) getAudioTrack() common.AudioTrack { func (p *Publisher) getVideoTrack() common.VideoTrack { return p.VideoTrack } +func (p *Publisher) Equal(p2 IPublisher) bool { + return p.getIO() == p2.getIO() +} func (p *Publisher) OnEvent(event any) { switch v := event.(type) { case IPublisher: - if v.getIO() == p.getIO() { //第一任 + if p.Equal(v) { //第一任 p.AudioTrack = p.Stream.NewAudioTrack() p.VideoTrack = p.Stream.NewVideoTrack() } else { // 使用前任的track,因为订阅者都挂在前任的上面