Skip to content

Commit

Permalink
feat: echo the used codec in setPublisher
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz committed Dec 23, 2024
1 parent b5cd7b7 commit 502ac83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions packages/client/src/gen/video/sfu/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { MessageType } from '@protobuf-ts/runtime';
import { Struct } from '../../../google/protobuf/struct';
import { Timestamp } from '../../../google/protobuf/timestamp';

/**
* CallState is the current state of the call
* as seen by an SFU.
Expand Down Expand Up @@ -370,6 +371,10 @@ export interface TrackInfo {
* @generated from protobuf field: bool muted = 10;
*/
muted: boolean;
/**
* @generated from protobuf field: stream.video.sfu.models.Codec codec = 11;
*/
codec?: Codec;
}
/**
* @generated from protobuf message stream.video.sfu.models.Error
Expand Down Expand Up @@ -1313,6 +1318,7 @@ class TrackInfo$Type extends MessageType<TrackInfo> {
{ no: 8, name: 'stereo', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 9, name: 'red', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 10, name: 'muted', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
{ no: 11, name: 'codec', kind: 'message', T: () => Codec },
]);
}
}
Expand Down
7 changes: 4 additions & 3 deletions packages/client/src/rtc/Publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ export class Publisher extends BasePeerConnection {
private getAnnouncedTracks = (sdp?: string): TrackInfo[] => {
sdp = sdp || this.pc.localDescription?.sdp;
const trackInfos: TrackInfo[] = [];
for (const transceiverId of this.transceiverCache.items()) {
const { publishOption, transceiver } = transceiverId;
for (const bundle of this.transceiverCache.items()) {
const { transceiver, publishOption } = bundle;
const track = transceiver.sender.track;
if (!track) continue;

Expand Down Expand Up @@ -539,7 +539,7 @@ export class Publisher extends BasePeerConnection {
transceiver: RTCRtpTransceiver,
publishOption: PublishOption,
sdp: string | undefined,
) => {
): TrackInfo => {
const track = transceiver.sender.track!;
const isTrackLive = track.readyState === 'live';
const layers = isTrackLive
Expand All @@ -561,6 +561,7 @@ export class Publisher extends BasePeerConnection {
dtx: isAudioTrack && !!audioSettings?.opus_dtx_enabled,
red: isAudioTrack && !!audioSettings?.redundant_coding_enabled,
muted: !isTrackLive,
codec: publishOption.codec,
};
};

Expand Down

0 comments on commit 502ac83

Please sign in to comment.