srs icon indicating copy to clipboard operation
srs copied to clipboard

WebRTC: playing before publishing

Open w41203208 opened this issue 2 years ago • 5 comments

player before publisher in webrtc

Why happen problem when I playing before publishing on Unity platform, but on the website platform don't hanppen

  1. SRS Version: I use development branch

Problem

  1. if streamUrl haven't be used, situation of player before publisher won't show screen at player but I am sure that pkt has passed to player consumer
  2. if streamUrl have be used above situation will not happen and successfully show screen on player
  3. Unity platform will happne this problem but website no.

w41203208 avatar Sep 01 '23 08:09 w41203208

I have same issue,too.

DannisMa avatar Sep 05 '23 10:09 DannisMa

I have fixed this problem. Thank you!

w41203208 avatar Sep 13 '23 08:09 w41203208

How did you fix it? Could you share the details?

TRANS_BY_GPT4

winlinvip avatar Sep 14 '23 02:09 winlinvip

I find that pkt pt no change to player track pt to in SrsRtcVideoSendTrack and SrsRtcAudioSendTrack on_rtp function, if player before publisher is happened.

Because below condition is no match, I do checking SrsSource and change player track media pt_of_publisher to be SrsSource pulisher's track media pt which is same ssrc with player track. Ensure below condition has excuted.

// Should update PT, because subscriber may use different PT to publisher.
    if (track_desc_->media_ && pkt->header.get_payload_type() == track_desc_->media_->pt_of_publisher_) {
        // If PT is media from publisher, change to PT of media for subscriber.
        pkt->header.set_payload_type(track_desc_->media_->pt_);
    } else if (track_desc_->red_ && pkt->header.get_payload_type() == track_desc_->red_->pt_of_publisher_) {
        // If PT is RED from publisher, change to PT of RED for subscriber.
        pkt->header.set_payload_type(track_desc_->red_->pt_);
    } else {
        // TODO: FIXME: Should update PT for RTX.
    }

This is my temporary solution. And it can work.

w41203208 avatar Sep 18 '23 07:09 w41203208

Has this issue been resolved?

SZ937GroupMaster avatar Jan 04 '24 04:01 SZ937GroupMaster

Should have been fixed.

winlinvip avatar Mar 22 '24 04:03 winlinvip