Skip to content

Commit

Permalink
Merge pull request #68 from ctrlaltdavid/dev/log-warnings-once
Browse files Browse the repository at this point in the history
Log certain warnings only once.
  • Loading branch information
digisomni authored Dec 2, 2021
2 parents a722486 + d5552c2 commit 77f5991
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/domain/audio-client/AudioClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class AudioClient {
#_avatarBoundingBoxCorner = { x: -0.5, y: 0.0, z: -0.5 };
#_avatarBoundingBoxScale = { x: 1, y: 2, z: 1 };

// WEBRTC TODO: Remove when have logger with "once" function.
#_haveWarnedAudioEnvironment = false;
#_haveWarnedAudioStreamStats = false;


constructor(contextID: number) {

Expand Down Expand Up @@ -435,7 +439,10 @@ class AudioClient {
#processStreamStatsPacket = (message: ReceivedMessage, sendingNode: Node | null): void => { // eslint-disable-line
// C++ void AudioIOStats::processStreamStatsPacket(ReceivedMessage*, Node* sendingNode)

console.warn("AudioClient: AudioStreamStats packet not processed.");
if (!this.#_haveWarnedAudioStreamStats) {
console.warn("AudioClient: AudioStreamStats packet not processed.");
this.#_haveWarnedAudioStreamStats = true;
}

// WEBRTC TODO: Address further C++ code.

Expand All @@ -447,7 +454,10 @@ class AudioClient {
#handleAudioEnvironmentDataPacket = (message: ReceivedMessage): void => { // eslint-disable-line
// C++ void handleAudioEnvironmentDataPacket(ReceivedMessage* message)

console.warn("AudioClient: AudioEnvironment packet not processed.");
if (!this.#_haveWarnedAudioEnvironment) {
console.warn("AudioClient: AudioEnvironment packet not processed.");
this.#_haveWarnedAudioEnvironment = true;
}

// WEBRTC TODO: Address further C++ code.

Expand Down
8 changes: 7 additions & 1 deletion src/domain/audio/InboundAudioStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class InboundAudioStream {
#_selectedCodecName = "";
#_decoder = null;

// WEBRTC TODO: Remove when have logger with "once" function.
#_haveWarnedWriteDroppableSilentFrames = false;;


/* eslint-disable */
// @ts-ignore
Expand Down Expand Up @@ -124,7 +127,10 @@ class InboundAudioStream {
// C++ int writeDroppableSilentFrames(int silentFrames)

// WEBRTC TODO: Address further C++ code.
console.warn("InboundAudioStream.#writeDroppableSilentFrames() not implemented. Frames:", silentFrames);
if (!this.#_haveWarnedWriteDroppableSilentFrames) {
console.warn("InboundAudioStream.#writeDroppableSilentFrames() not implemented. Frames:", silentFrames);
this.#_haveWarnedWriteDroppableSilentFrames = true;
}

}

Expand Down

0 comments on commit 77f5991

Please sign in to comment.