WebRTC: playing before publishing
player before publisher in webrtc
Why happen problem when I playing before publishing on Unity platform, but on the website platform don't hanppen
- SRS Version: I use development branch
Problem
- 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
- if streamUrl have be used above situation will not happen and successfully show screen on player
- Unity platform will happne this problem but website no.
I have same issue,too.
I have fixed this problem. Thank you!
How did you fix it? Could you share the details?
TRANS_BY_GPT4
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.
Has this issue been resolved?
Should have been fixed.