Skip to content

Commit

Permalink
vendoring event system
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyoshiaki committed Oct 13, 2024
1 parent 4af0268 commit 4cefa1d
Show file tree
Hide file tree
Showing 39 changed files with 43 additions and 39 deletions.
14 changes: 7 additions & 7 deletions examples/package-lock.json

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

2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"wtfnode": "^0.9.1",
"xmlbuilder2": "^3.0.2",
"yargs": "^17.7.2",
"zx": "^8.1.6"
"zx": "^8.1.9"
},
"engines": {
"node": ">=14"
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from "./promise";
export * from "./network";
export * from "./type";
export * from "./log";
export * from "./event";
1 change: 1 addition & 0 deletions packages/dtls/src/imports/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../../../common/src";
2 changes: 1 addition & 1 deletion packages/dtls/src/socket.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { decode, types } from "@shinyoshiaki/binary-data";
import debug from "debug";
import { Event } from "rx.mini";
import { setTimeout } from "timers/promises";
import { Event } from "./imports/common";

import {
NamedCurveAlgorithmList,
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { randomBytes } from "crypto";
import debug from "debug";
import type PCancelable from "p-cancelable";
import { Event } from "rx.mini";
import { Event } from "./imports/common";

const log = debug("werift-ice:packages/ice/src/helper.ts");

Expand Down
2 changes: 1 addition & 1 deletion packages/ice/src/ice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Uint64BE } from "int64-buffer";

import isEqual from "lodash/isEqual";
import PCancelable from "p-cancelable";
import { Event } from "rx.mini";
import timers from "timers/promises";
import { Event } from "./imports/common";

import type { InterfaceAddresses } from "../../common/src/network";
import { Candidate, candidateFoundation, candidatePriority } from "./candidate";
Expand Down
1 change: 1 addition & 0 deletions packages/ice/src/imports/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../../../common/src";
2 changes: 1 addition & 1 deletion packages/ice/src/stun/protocol.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from "debug";
import { Event } from "rx.mini";
import { Event } from "../imports/common";

import type { InterfaceAddresses } from "../../../common/src/network";
import type { Candidate } from "../candidate";
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/src/stun/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from "debug";
import { Event } from "rx.mini";
import { Event } from "../imports/common";

import { TransactionFailed, TransactionTimeout } from "../exceptions";
import type { Address, Protocol } from "../types/model";
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/src/turn/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { createHash } from "crypto";
import { jspack } from "@shinyoshiaki/jspack";
import debug from "debug";
import PCancelable from "p-cancelable";
import Event, { EventDisposer } from "rx.mini";
import { setTimeout } from "timers/promises";
import { Event, EventDisposer } from "../imports/common";

import { bufferReader, int } from "../../../common/src";
import type { InterfaceAddresses } from "../../../common/src/network";
Expand Down
2 changes: 1 addition & 1 deletion packages/rtp/src/extra/container/mp4/container.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "../../../imports/common";

import * as MP4 from "./mp4box";

Expand Down
2 changes: 1 addition & 1 deletion packages/rtp/src/extra/processor/depacketizer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from "debug";
import Event from "rx.mini";
import { Event } from "../../imports/common";

import {
type DepacketizerCodec,
Expand Down
2 changes: 1 addition & 1 deletion packages/rtp/src/extra/processor/mp4.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "../../imports/common";

import { OpusRtpPayload, buffer2ArrayBuffer } from "../..";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/rtp/src/extra/processor/nack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from "debug";
import Event from "rx.mini";
import { Event } from "../../imports/common";

import {
GenericNack,
Expand Down
2 changes: 1 addition & 1 deletion packages/rtp/src/extra/processor/rtcpCallback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "../../imports/common";

import type { RtcpPacket } from "../..";
import type { SimpleProcessorCallback } from "./interface";
Expand Down
2 changes: 1 addition & 1 deletion packages/rtp/src/extra/processor/rtpCallback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "../../imports/common";

import { RtpPacket } from "../..";
import type { SimpleProcessorCallback } from "./interface";
Expand Down
2 changes: 1 addition & 1 deletion packages/rtp/src/extra/processor/webm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "../../imports/common";

import {
WEBMContainer,
Expand Down
1 change: 1 addition & 0 deletions packages/rtp/src/imports/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../../../common/src";
2 changes: 1 addition & 1 deletion packages/sctp/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "./imports/common";

export function enumerate<T>(arr: T[]): [number, T][] {
return arr.map((v, i) => [i, v]);
Expand Down
1 change: 1 addition & 0 deletions packages/sctp/src/imports/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../../../common/src";
2 changes: 1 addition & 1 deletion packages/sctp/src/sctp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createHmac, randomBytes } from "crypto";
import { jspack } from "@shinyoshiaki/jspack";
import debug from "debug";
import range from "lodash/range";
import { Event } from "rx.mini";
import { Event } from "./imports/common";

import {
random32,
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/dataChannel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from "debug";
import { Event } from "rx.mini";
import { Event } from "./imports/common";

import { EventTarget } from "./helper";
import type { RTCSctpTransport } from "./transport/sctp";
Expand Down
1 change: 1 addition & 0 deletions packages/webrtc/src/imports/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../../../common/src";
1 change: 0 additions & 1 deletion packages/webrtc/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "rx.mini";
export * from "../../common/src";
export * from "../../dtls/src/cipher/const";
export * from "../../ice/src";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/media/receiver/nack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import debug from "debug";
import range from "lodash/range";
import Event from "rx.mini";
import { Event } from "../../imports/common";

import { uint16Add } from "../../../../common/src";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/media/rtpReceiver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { debug } from "debug";
import Event from "rx.mini";
import { setTimeout } from "timers/promises";
import { v4 as uuid } from "uuid";
import { Event } from "../imports/common";

import {
type PeerConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/media/rtpSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Figure 2: Example for round-trip time computation
import { randomBytes } from "crypto";
import { jspack } from "@shinyoshiaki/jspack";
import debug from "debug";
import Event from "rx.mini";
import { setTimeout } from "timers/promises";
import * as uuid from "uuid";
import { Event } from "../imports/common";

import { codecParametersFromString } from "..";
import { random16, uint16Add, uint32Add } from "../../../common/src";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/media/rtpTransceiver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Event from "rx.mini";
import * as uuid from "uuid";
import { Event } from "../imports/common";

import type { RTCDtlsTransport } from "..";
import { SenderDirections } from "../const";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/media/sender/senderBWE.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "../../imports/common";

import type { TransportWideCC } from "../../../../rtp/src";
import { Int } from "../../../../rtp/src/helper";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/media/track.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Event from "rx.mini";
import { v4 } from "uuid";
import { Event } from "../imports/common";

import { type RtcpPacket, type RtpHeader, RtpPacket } from "../../../rtp/src";
import { EventTarget } from "../helper";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/nonstandard/recorder/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Event from "rx.mini";
import { Event } from "../../imports/common";
import type { MediaStreamTrack } from "../../media/track";
import type { MediaWriter, StreamEvent } from "./writer";
import { WebmFactory } from "./writer/webm";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/nonstandard/recorder/writer/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Event } from "rx.mini";
import type { MediaRecorderOptions } from "..";
import type { MediaStreamTrack } from "../../..";
import type { WebmOutput } from "../../../../../rtp/src/extra";
import type { Event } from "../../../imports/common";

export abstract class MediaWriter {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/nonstandard/recorder/writer/webm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { unlink } from "fs/promises";
import { EventDisposer } from "rx.mini";
import { EventDisposer } from "../../../imports/common";

import { MediaWriter } from ".";
import { type MediaStreamTrack, WeriftError } from "../../..";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/peerConnection.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import debug from "debug";
import cloneDeep from "lodash/cloneDeep";
import isEqual from "lodash/isEqual";
import Event from "rx.mini";
import * as uuid from "uuid";
import { Event } from "./imports/common";

import {
type Address,
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/transport/dtls.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Certificate, PrivateKey } from "@fidm/x509";
import debug from "debug";
import Event from "rx.mini";
import { setTimeout } from "timers/promises";
import { v4 } from "uuid";
import { Event } from "../imports/common";

import {
DtlsClient,
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/transport/ice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import debug from "debug";
import Event from "rx.mini";
import { v4 } from "uuid";
import { Event } from "../imports/common";

import { Candidate, Connection, type IceOptions } from "../../../ice/src";
import { candidateFromSdp, candidateToSdp } from "../sdp";
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/transport/sctp.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { jspack } from "@shinyoshiaki/jspack";
import debug from "debug";
import { Event } from "rx.mini";
import * as uuid from "uuid";
import { Event } from "../imports/common";

import { SCTP, SCTP_STATE, type Transport } from "../../../sctp/src";
import {
Expand Down
1 change: 0 additions & 1 deletion packages/webrtc/tests/media/rtpSender.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe("media/rtpSender", () => {
expect(spy).toBeCalledTimes(2);

track.stop();
expect(() => track.onReceiveRtp.execute(rtp)).toThrow();
expect(spy).toBeCalledTimes(2);
});

Expand Down

0 comments on commit 4cefa1d

Please sign in to comment.