Skip to content

Commit

Permalink
Merge branch 'v3' into add-sr-trace
Browse files Browse the repository at this point in the history
  • Loading branch information
GithubUser8080 committed Dec 21, 2023
2 parents 2f40dae + 8365c62 commit 5d402d4
Show file tree
Hide file tree
Showing 27 changed files with 442 additions and 63 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/mediasoup-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ jobs:

- name: cargo test
run: cargo test --verbose

- name: cargo doc
run: cargo doc --locked --all --no-deps --lib
env:
DOCS_RS: '1'
RUSTDOCFLAGS: '-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links'

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@

### NEXT

* worker: Do not use references for async callbacks ([PR #1274](https://github.com/versatica/mediasoup/pull/1274)).


### 3.13.12

* worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
* npm installation: Don't require Python if valid worker prebuilt binary is fetched ([PR #1265](https://github.com/versatica/mediasoup/pull/1265)).
* Update h264-profile-level-id NPM dependency to 1.1.0.


### 3.13.11
Expand Down
9 changes: 4 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions node/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ const eslintConfig =
'computed-property-spacing' : 2,
'constructor-super' : 2,
'curly' : [ 2, 'all' ],
// Unfortunatelly `curly` does not apply to blocks in `switch` cases so
// this is needed.
'no-restricted-syntax' : [ 2,
{
'selector' : 'SwitchCase > *.consequent[type!="BlockStatement"]',
'message' : 'Switch cases without blocks are disallowed'
}
],
'func-call-spacing' : 2,
'generator-star-spacing' : 2,
'guard-for-in' : 2,
Expand Down
22 changes: 21 additions & 1 deletion node/src/Channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,13 @@ export class Channel extends EnhancedEventEmitter
}

default:
{
// eslint-disable-next-line no-console
console.warn(
`worker[pid:${pid}] unexpected data: %s`,
payload.toString('utf8', 1));
payload.toString('utf8', 1)
);
}
}
}
catch (error)
Expand Down Expand Up @@ -432,11 +435,16 @@ export class Channel extends EnhancedEventEmitter
switch (response.error()!)
{
case 'TypeError':
{
sent.reject(new TypeError(response.reason()!));

break;
}

default:
{
sent.reject(new Error(response.reason()!));
}
}
}
else
Expand Down Expand Up @@ -470,24 +478,36 @@ export class Channel extends EnhancedEventEmitter
{
// 'D' (a debug log).
case 'D':
{
logger.debug(`[pid:${pid}] ${logData.slice(1)}`);

break;
}

// 'W' (a warn log).
case 'W':
{
logger.warn(`[pid:${pid}] ${logData.slice(1)}`);

break;
}

// 'E' (a error log).
case 'E':
{
logger.error(`[pid:${pid}] ${logData.slice(1)}`);

break;
}

// 'X' (a dump log).
case 'X':
{
// eslint-disable-next-line no-console
console.log(logData.slice(1));

break;
}
}
}
}
34 changes: 34 additions & 0 deletions node/src/Consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -999,17 +999,34 @@ function consumerTraceEventTypeToFbs(eventType: ConsumerTraceEventType)
switch (eventType)
{
case 'keyframe':
{
return FbsConsumer.TraceEventType.KEYFRAME;
}

case 'fir':
{
return FbsConsumer.TraceEventType.FIR;
}

case 'nack':
{
return FbsConsumer.TraceEventType.NACK;
}

case 'pli':
{
return FbsConsumer.TraceEventType.PLI;
}

case 'rtp':
{
return FbsConsumer.TraceEventType.RTP;
}

default:
{
throw new TypeError(`invalid ConsumerTraceEventType: ${eventType}`);
}
}
}

Expand All @@ -1019,17 +1036,34 @@ function consumerTraceEventTypeFromFbs(traceType: FbsConsumer.TraceEventType)
switch (traceType)
{
case FbsConsumer.TraceEventType.KEYFRAME:
{
return 'keyframe';
}

case FbsConsumer.TraceEventType.FIR:
{
return 'fir';
}

case FbsConsumer.TraceEventType.NACK:
{
return 'nack';
}

case FbsConsumer.TraceEventType.PLI:
{
return 'pli';
}

case FbsConsumer.TraceEventType.RTP:
{
return 'rtp';
}

default:
{
throw new TypeError(`invalid FbsConsumer.TraceEventType: ${traceType}`);
}
}
}

Expand Down
13 changes: 13 additions & 0 deletions node/src/DataConsumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,11 +762,19 @@ export function dataConsumerTypeToFbs(type: DataConsumerType): FbsDataProducer.T
switch (type)
{
case 'sctp':
{
return FbsDataProducer.Type.SCTP;
}

case 'direct':
{
return FbsDataProducer.Type.DIRECT;
}

default:
{
throw new TypeError('invalid DataConsumerType: ${type}');
}
}
}

Expand All @@ -775,9 +783,14 @@ export function dataConsumerTypeFromFbs(type: FbsDataProducer.Type): DataConsume
switch (type)
{
case FbsDataProducer.Type.SCTP:
{
return 'sctp';
}

case FbsDataProducer.Type.DIRECT:
{
return 'direct';
}
}
}

Expand Down
13 changes: 13 additions & 0 deletions node/src/DataProducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,19 @@ export function dataProducerTypeToFbs(type: DataProducerType): FbsDataProducer.T
switch (type)
{
case 'sctp':
{
return FbsDataProducer.Type.SCTP;
}

case 'direct':
{
return FbsDataProducer.Type.DIRECT;
}

default:
{
throw new TypeError('invalid DataConsumerType: ${type}');
}
}
}

Expand All @@ -488,9 +496,14 @@ export function dataProducerTypeFromFbs(type: FbsDataProducer.Type): DataProduce
switch (type)
{
case FbsDataProducer.Type.SCTP:
{
return 'sctp';
}

case FbsDataProducer.Type.DIRECT:
{
return 'direct';
}
}
}

Expand Down
Loading

0 comments on commit 5d402d4

Please sign in to comment.