Skip to content

Commit

Permalink
refactor(fullaudio): remove all references to listen only in logs
Browse files Browse the repository at this point in the history
That was making me incredibly mad
  • Loading branch information
prlanzarin committed Dec 9, 2021
1 parent 945078a commit a657e8c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/audio/FullAudioManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module.exports = class AudioManager extends BaseManager {
sdpAnswer : sdpAnswer
}, C.FROM_AUDIO);

Logger.info(this._logPrefix, `Started listen only session for user ${userId}`,
Logger.info(this._logPrefix, `Started full audio session for user ${userId}`,
AudioManager.getMetadataFromMessage(message));
})
.catch(error => {
Expand Down Expand Up @@ -248,7 +248,7 @@ module.exports = class AudioManager extends BaseManager {
if (session) {
const metadata = AudioManager.getMetadataFromMessage(message);
session.processAnswer(answer, connectionId).then(() => {
Logger.debug(this._logPrefix, 'Listen only remote description processed',
Logger.debug(this._logPrefix, 'Full audio remote description processed',
metadata
);
}).catch(error => {
Expand Down
38 changes: 19 additions & 19 deletions lib/audio/fullaudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ module.exports = class Audio extends BaseProvider {
_onSubscriberMediaFlowing (connectionId, mediaData = {}) {
const { role } = mediaData;

Logger.debug(LOG_PREFIX, `Listen only WebRTC media is FLOWING`,
Logger.debug(LOG_PREFIX, `Full audio WebRTC media is FLOWING`,
this._getFullLogMetadata(connectionId));
this.clearMediaFlowingTimeout(connectionId);

Expand All @@ -224,13 +224,13 @@ module.exports = class Audio extends BaseProvider {
}

_onSubscriberMediaNotFlowing (connectionId) {
Logger.debug(LOG_PREFIX, `Listen only WebRTC media is NOT_FLOWING`,
Logger.debug(LOG_PREFIX, `Full audio WebRTC media is NOT_FLOWING`,
this._getFullLogMetadata(connectionId));
this.setMediaFlowingTimeout(connectionId);
}

_onSubscriberMediaNotFlowingTimeout (connectionId) {
Logger.error(LOG_PREFIX, `Listen only WebRTC media NOT_FLOWING timeout reached`,
Logger.error(LOG_PREFIX, `Full audio WebRTC media NOT_FLOWING timeout reached`,
this._getFullLogMetadata(connectionId));
this.sendToClient({
type: 'audio',
Expand All @@ -242,7 +242,7 @@ module.exports = class Audio extends BaseProvider {

setMediaFlowingTimeout (connectionId) {
if (!this._mediaFlowingTimeouts[connectionId]) {
Logger.debug(LOG_PREFIX, `Listen only NOT_FLOWING timeout set`,
Logger.debug(LOG_PREFIX, `Full audio NOT_FLOWING timeout set`,
{ ...this._getFullLogMetadata(connectionId), MEDIA_FLOW_TIMEOUT_DURATION });
this._mediaFlowingTimeouts[connectionId] = setTimeout(() => {
this._onSubscriberMediaNotFlowingTimeout(connectionId);
Expand All @@ -260,19 +260,19 @@ module.exports = class Audio extends BaseProvider {
}

_onSubscriberMediaConnected (connectionId) {
Logger.info(LOG_PREFIX, `Listen only WebRTC media is CONNECTED`,
Logger.info(LOG_PREFIX, `Full audio WebRTC media is CONNECTED`,
this._getFullLogMetadata(connectionId));
this.clearMediaStateTimeout(connectionId);
}

_onSubscriberMediaDisconnected (connectionId) {
Logger.warn(LOG_PREFIX, `Listen only WebRTC media is DISCONNECTED`,
Logger.warn(LOG_PREFIX, `Full audio WebRTC media is DISCONNECTED`,
this._getFullLogMetadata(connectionId));
this.setMediaStateTimeout(connectionId);
}

_onSubscriberMediaDisconnectedTimeout (connectionId) {
Logger.error(LOG_PREFIX, `Listen only WebRTC media DISCONNECTED timeout reached`,
Logger.error(LOG_PREFIX, `Full audio WebRTC media DISCONNECTED timeout reached`,
this._getFullLogMetadata(connectionId));

this.sendToClient({
Expand All @@ -285,7 +285,7 @@ module.exports = class Audio extends BaseProvider {

setMediaStateTimeout (connectionId) {
if (!this._mediaStateTimeouts[connectionId]) {
Logger.warn(LOG_PREFIX, `Listen only DISCONNECTED media state timeout set`,
Logger.warn(LOG_PREFIX, `Full audio DISCONNECTED media state timeout set`,
{ ...this._getFullLogMetadata(connectionId), MEDIA_STATE_TIMEOUT_DURATION });
this._mediaStateTimeouts[connectionId] = setTimeout(() => {
this._onSubscriberMediaDisconnectedTimeout(connectionId);
Expand Down Expand Up @@ -428,7 +428,7 @@ module.exports = class Audio extends BaseProvider {

case "MediaFlowOutStateChange":
case "MediaFlowInStateChange":
Logger.debug(LOG_PREFIX, `Listen only WebRTC media received MediaFlow state`,
Logger.debug(LOG_PREFIX, `Full audio WebRTC media received MediaFlow state`,
{ ...logMetadata, state });

if (details === 'FLOWING') {
Expand All @@ -439,7 +439,7 @@ module.exports = class Audio extends BaseProvider {
break;

case C.MEDIA_SERVER_OFFLINE:
Logger.error(LOG_PREFIX, `WebRTC listen only session ${mediaId} received MEDIA_SERVER_OFFLINE event`,
Logger.error(LOG_PREFIX, `WebRTC full audio session ${mediaId} received MEDIA_SERVER_OFFLINE event`,
{ ...logMetadata, event });

this.emit(C.MEDIA_SERVER_OFFLINE, event);
Expand Down Expand Up @@ -668,12 +668,12 @@ module.exports = class Audio extends BaseProvider {
this.sourceAudioStatus = C.MEDIA_STARTED;
this.emit(C.MEDIA_STARTED);

Logger.info(LOG_PREFIX, `Listen only source WebRTC relay successfully created`,
Logger.info(LOG_PREFIX, `Full audio source WebRTC relay successfully created`,
{ ...this._getPartialLogMetadata(), mediaId: this.sourceAudio, userId: this.userId });
return resolve(true);
}
} catch (error) {
Logger.error(LOG_PREFIX, `Error on starting listen only source WebRTC relay`,
Logger.error(LOG_PREFIX, `Error on starting full audio source WebRTC relay`,
{ ...this._getPartialLogMetadata(), error });
this.sourceAudioStatus = C.MEDIA_NEGOTIATION_FAILED;
this._stopSourceAudio();
Expand Down Expand Up @@ -746,7 +746,7 @@ module.exports = class Audio extends BaseProvider {
this.mcsUserId = mcsUserId;
} catch (error) {
const normalizedError = this._handleError(LOG_PREFIX, error, "recv", userId);
Logger.error(LOG_PREFIX, `mcs-core join failure for new listen only session`, {
Logger.error(LOG_PREFIX, `mcs-core join failure for new full audio session`, {
...this._getPartialLogMetadata(),
connectionId,
userId,
Expand All @@ -758,7 +758,7 @@ module.exports = class Audio extends BaseProvider {
// Storing the user data to be used by the pub calls
const user = { userId, mcsUserId, connected: false };
this.addUser(connectionId, user);
Logger.info(LOG_PREFIX, `Starting new listen only session`,
Logger.info(LOG_PREFIX, `Starting new full audio session`,
this._getFullLogMetadata(connectionId));

try {
Expand Down Expand Up @@ -844,7 +844,7 @@ module.exports = class Audio extends BaseProvider {
({ mediaId, answer } = await this.mcs.subscribe(mcsUserId,
this.sourceAudio, C.WEBRTC, options));
} catch (subscribeError) {
Logger.error(LOG_PREFIX, `New listen only session failed to subscribe to GLOBAL_AUDIO`,
Logger.error(LOG_PREFIX, `New full audio session failed to subscribe to GLOBAL_AUDIO`,
{ ...this._getPartialLogMetadata(), subscribeError});
throw (this._handleError(LOG_PREFIX, subscribeError, "recv", connectionId));
}
Expand All @@ -859,15 +859,15 @@ module.exports = class Audio extends BaseProvider {

this.audioEndpoints[connectionId] = { mcsUserId, mediaId };
this._flushCandidatesQueue(connectionId);
Logger.info(LOG_PREFIX, 'Listen only session subscribed to global audio',
Logger.info(LOG_PREFIX, 'Full audio session subscribed to global audio',
this._getFullLogMetadata(connectionId));
return answer;
}

processAnswer (answer, connectionId) {
const endpoint = this.audioEndpoints[connectionId];

Logger.debug(LOG_PREFIX, 'Processing listen only answer',
Logger.debug(LOG_PREFIX, 'Processing full audio answer',
this._getFullLogMetadata(connectionId));

if (endpoint && endpoint.mediaId) {
Expand Down Expand Up @@ -905,7 +905,7 @@ module.exports = class Audio extends BaseProvider {
if (listener && listener.mediaId && listener.mcsUserId) {
try {
await this.mcs.unsubscribe(listener.mcsUserId, listener.mediaId);
Logger.info(LOG_PREFIX, 'Listen only session stopped',
Logger.info(LOG_PREFIX, 'Full audio session stopped',
this._getFullLogMetadata(connectionId));
} catch (error) {
Logger.warn(LOG_PREFIX, `Error on unsubscribing listener media ${listener.mediaId}`,
Expand Down Expand Up @@ -952,7 +952,7 @@ module.exports = class Audio extends BaseProvider {
try {
await this.stopListener(connectionId);
} catch (error) {
Logger.error(LOG_PREFIX, `Listen only session stop failed`,
Logger.error(LOG_PREFIX, `Full audio session stop failed`,
{ ...this._getFullLogMetadata(connectionId), error });
}
}
Expand Down

0 comments on commit a657e8c

Please sign in to comment.