Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with one-way audio after a transfer #2193

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/webrtc/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,11 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
private pushNewLocalFeed(stream: MediaStream, purpose: SDPStreamMetadataPurpose, addToPeerConnection = true): void {
const userId = this.client.getUserId();

// TODO: Find out what is going on here
// why do we enable audio (and only audio) tracks here? -- matthew
// Tracks don't always start off enabled, eg. chrome will give a disabled
// audio track if you ask for user media audio and already had one that
// you'd set to disabled (presumably because it clones them internally).
setTracksEnabled(stream.getAudioTracks(), true);
setTracksEnabled(stream.getVideoTracks(), true);

// We try to replace an existing feed if there already is one with the same purpose
const existingFeed = this.getLocalFeeds().find((feed) => feed.purpose === purpose);
Expand Down Expand Up @@ -630,7 +632,8 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
`id="${track.id}", ` +
`kind="${track.kind}", ` +
`streamId="${callFeed.stream.id}", ` +
`streamPurpose="${callFeed.purpose}"` +
`streamPurpose="${callFeed.purpose}", ` +
`enabled=${track.enabled}` +
`) to peer connection`,
);
senderArray.push(this.peerConn.addTrack(track, callFeed.stream));
Expand Down Expand Up @@ -2078,6 +2081,12 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap

try {
const stream = await this.client.getMediaHandler().getUserMediaStream(audio, video);

// make sure all the tracks are enabled (same as pushNewLocalFeed -
// we probably ought to just have one code path for adding streams)
setTracksEnabled(stream.getAudioTracks(), true);
setTracksEnabled(stream.getVideoTracks(), true);

const callFeed = new CallFeed({
client: this.client,
roomId: this.roomId,
Expand Down