always reevaluate remote media when receiving a new remote track

not just when we don't know the stream already
this caused the video track to not appear when the other party sends the
invite.
Also added more logging
This commit is contained in:
Bruno Windels 2022-04-27 17:33:27 +02:00
parent 230ccd95ab
commit be04eeded0

View file

@ -902,6 +902,9 @@ export class PeerCall implements IDisposable {
private onRemoteTrack(track: Track, streams: ReadonlyArray<Stream>, log: ILogItem) { private onRemoteTrack(track: Track, streams: ReadonlyArray<Stream>, log: ILogItem) {
log.set("kind", track.kind);
log.set("id", track.id);
log.set("streams", streams.map(s => s.id));
if (streams.length === 0) { if (streams.length === 0) {
log.log({l: `ignoring ${track.kind} streamless track`, id: track.id}); log.log({l: `ignoring ${track.kind} streamless track`, id: track.id});
return; return;
@ -932,11 +935,12 @@ export class PeerCall implements IDisposable {
disposeListener, disposeListener,
stream stream
}); });
this.updateRemoteMedia(log);
} }
this.updateRemoteMedia(log);
} }
private updateRemoteMedia(log: ILogItem): void { private updateRemoteMedia(log: ILogItem): void {
log.wrap("reevaluating remote media", log => {
this._remoteMedia.userMedia = undefined; this._remoteMedia.userMedia = undefined;
this._remoteMedia.screenShare = undefined; this._remoteMedia.screenShare = undefined;
if (this.remoteSDPStreamMetadata) { if (this.remoteSDPStreamMetadata) {
@ -958,13 +962,22 @@ export class PeerCall implements IDisposable {
metaData.audio_muted || !audioReceiver?.track, metaData.audio_muted || !audioReceiver?.track,
metaData.video_muted || !videoReceiver?.track metaData.video_muted || !videoReceiver?.track
); );
log.log({
l: "setting userMedia",
micMuted: this._remoteMuteSettings.microphone,
cameraMuted: this._remoteMuteSettings.camera
});
} else if (metaData.purpose === SDPStreamMetadataPurpose.Screenshare) { } else if (metaData.purpose === SDPStreamMetadataPurpose.Screenshare) {
this._remoteMedia.screenShare = stream; this._remoteMedia.screenShare = stream;
log.log("setting screenShare");
} }
} else {
log.log({l: "no metadata yet for stream, ignoring for now", id: stream.id});
} }
} }
} }
this.options.emitUpdate(this, undefined); this.options.emitUpdate(this, undefined);
});
} }
private updateLocalMedia(localMedia: LocalMedia, logItem: ILogItem): Promise<void> { private updateLocalMedia(localMedia: LocalMedia, logItem: ILogItem): Promise<void> {