owt-client-native icon indicating copy to clipboard operation
owt-client-native copied to clipboard

Issue with chat tracks on some browsers

Open JamesTerm opened this issue 4 years ago • 1 comments

I am not sure if this issue is in 4.3 as we are still in 4.2 but if it is, I want to share a fix. I am not sure if it is the correct fix so I'm not doing a pr, but instead wish to share it here:

The problem is that the id's being sent for chat-signal are different than chat-tracks on some browsers, whether or not if they should be identical remains to be seen, but fortunately the author already cached the id's and did nothing with them, so I am able to pull them in.

This is in P2PPeerConnectionChannel::OnAddStream() (around line 577 in p2ppeerconnectionchannel.cc)

See this patched here around line 582

    //Case 108782: Use remote_track_source_info_ for the track id's as safari will have a different
    //set of ID's for the chat-signal which is the ID's pulled by default, we'll keep this logic intact
    //if for some reason we do not have the correct size.  Note: this may be problematic for future if there
    //are more than 2 streams
    if (remote_track_source_info_.size()<2)
    {
      for (const auto& track : stream->GetAudioTracks()) {
        stream_tracks.append(track->id()); RTC_LOG(LS_INFO) << "JDK track idA " << track->id();
      }
      for (const auto& track : stream->GetVideoTracks()) {
        stream_tracks.append(track->id());  RTC_LOG(LS_INFO) << "JDK track idV " << track->id();
      }
    }
    else
    {
      for (const auto& track : remote_track_source_info_ )
      {
        stream_tracks.append(track.first.c_str());
        RTC_LOG(LS_INFO) << "JDK chat-track id " << track.first.c_str();
      }
    }

JamesTerm avatar Feb 24 '21 15:02 JamesTerm

Thanks for your patch. Track IDs are not required to be the same at local and remote side. Track source info is actually the source info of a RTP sender.

Reference: https://w3c.github.io/webrtc-pc/#rtp-media-api.

jianjunz avatar Apr 15 '21 06:04 jianjunz