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

[flatbuffers] Add pause() and resume() in DataProducer and DataConsumer #1104

Merged
Show file tree
Hide file tree
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
59 changes: 34 additions & 25 deletions node/src/Consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type ConsumerOptions<ConsumerAppData extends AppData = AppData> =
rtpCapabilities: RtpCapabilities;

/**
* Whether the Consumer must start in paused mode. Default false.
* Whether the consumer must start in paused mode. Default false.
*
* When creating a video Consumer, it's recommended to set paused to true,
* then transmit the Consumer parameters to the consuming endpoint and, once
Expand Down Expand Up @@ -187,12 +187,14 @@ export type ConsumerObserverEvents =
trace: [ConsumerTraceEventData];
};

export type SimpleConsumerDump = BaseConsumerDump & {
export type SimpleConsumerDump = BaseConsumerDump &
{
type: string;
rtpStream: RtpStreamDump;
};

export type SimulcastConsumerDump = BaseConsumerDump & {
export type SimulcastConsumerDump = BaseConsumerDump &
{
type: string;
rtpStream: RtpStreamDump;
preferredSpatialLayer: number;
Expand All @@ -205,7 +207,8 @@ export type SimulcastConsumerDump = BaseConsumerDump & {

export type SvcConsumerDump = SimulcastConsumerDump;

export type PipeConsumerDump = BaseConsumerDump & {
export type PipeConsumerDump = BaseConsumerDump &
{
type: string;
rtpStreams: RtpStreamDump[];
};
Expand All @@ -229,20 +232,22 @@ type ConsumerData =
type: ConsumerType;
};

type BaseConsumerDump = {
type BaseConsumerDump =
{
id: string;
producerId:string;
kind:MediaKind;
rtpParameters:RtpParameters;
consumableRtpEncodings?:RtpEncodingParameters[];
supportedCodecPayloadTypes:number[];
traceEventTypes:string[];
paused:boolean;
producerPaused:boolean;
priority:number;
producerId: string;
kind: MediaKind;
rtpParameters: RtpParameters;
consumableRtpEncodings?: RtpEncodingParameters[];
supportedCodecPayloadTypes: number[];
traceEventTypes: string[];
paused: boolean;
producerPaused: boolean;
priority: number;
};

type RtpStreamParameters = {
type RtpStreamParameters =
{
encodingIdx: number;
ssrc: number;
payloadType: number;
Expand All @@ -261,22 +266,25 @@ type RtpStreamParameters = {
temporalLayers: number;
};

type RtpStreamDump = {
type RtpStreamDump =
{
params: RtpStreamParameters;
score: number;
rtxStream?: RtxStreamDump;
};

type RtxStreamParameters = {
ssrc:number;
payloadType:number;
mimeType:string;
type RtxStreamParameters =
{
ssrc: number;
payloadType: number;
mimeType: string;
clockRate: number;
rrid?:string;
cname:string;
rrid?: string;
cname: string;
};

type RtxStreamDump = {
type RtxStreamDump =
{
params: RtxStreamParameters;
};

Expand Down Expand Up @@ -353,11 +361,11 @@ export class Consumer<ConsumerAppData extends AppData = AppData>
this.#internal = internal;
this.#data = data;
this.#channel = channel;
this.#appData = appData || {} as ConsumerAppData;
this.#paused = paused;
this.#producerPaused = producerPaused;
this.#score = score;
this.#preferredLayers = preferredLayers;
this.#appData = appData || {} as ConsumerAppData;

this.handleWorkerNotifications();
}
Expand Down Expand Up @@ -695,7 +703,8 @@ export class Consumer<ConsumerAppData extends AppData = AppData>

if (status.preferredLayers)
{
preferredLayers = {
preferredLayers =
{
spatialLayer : status.preferredLayers.spatialLayer,
temporalLayer : status.preferredLayers.temporalLayer !== null ?
status.preferredLayers.temporalLayer :
Expand Down
Loading