Skip to content

Commit

Permalink
chore: optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Aug 9, 2024
1 parent c3e7541 commit de58d8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions packages/rtc/src/engine/IrisClientObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ export class IrisClientObserver {
irisClient.agoraRTCClient?.channelName &&
!irisClient.agoraRTCClient.localTracks?.includes(publishTrack)
) {
if (!publishTrack.enabled) {
await this._engine.trackHelper.setEnabled(publishTrack, true);
}

try {
AgoraConsole.debug(`publishTrack ${publishTrack}`);
await irisClient.agoraRTCClient!.publish(publishTrack);
Expand Down Expand Up @@ -212,11 +208,9 @@ export class IrisClientObserver {
}
let agoraRTCClient = irisClient.agoraRTCClient;
let track = trackPackage.track as ILocalTrack;
if (agoraRTCClient?.localTracks?.indexOf(track) != -1) {
if (agoraRTCClient?.localTracks?.includes(track)) {

Check warning on line 211 in packages/rtc/src/engine/IrisClientObserver.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
AgoraConsole.debug(`unpublishTrack ${track}`);
if (!track?.enabled) {
await this._engine.clientHelper.unpublish(agoraRTCClient!, track);
}
await this._engine.clientHelper.unpublish(agoraRTCClient!, track);

Check warning on line 213 in packages/rtc/src/engine/IrisClientObserver.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 214 in packages/rtc/src/engine/IrisClientObserver.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}

Expand Down
2 changes: 1 addition & 1 deletion packages/rtc/src/helper/ImplHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export class ImplHelper {
let audioTrackPackages = irisClient.audioTrackPackages!;
let videoTrackPackage = irisClient.videoTrackPackage!;
let irisClientObserver = irisClientManager.irisClientObserver;
irisClientObserver.notifyLocal(NotifyType.UNPUBLISH_TRACK, [
await irisClientObserver.notifyLocal(NotifyType.UNPUBLISH_TRACK, [
...audioTrackPackages,
videoTrackPackage,
]);
Expand Down
2 changes: 1 addition & 1 deletion packages/rtc/src/impl/IAgoraMediaEngineImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class IMediaEngineImpl implements NATIVE_RTC.IMediaEngine {
if (!videoTrack.isPlaying && videoTrackPackage.element) {
this._engine.trackHelper.play(videoTrack, videoTrackPackage.element);
}
this._engine.irisClientManager.irisClientObserver.notifyLocal(
await this._engine.irisClientManager.irisClientObserver.notifyLocal(
NotifyType.PUBLISH_TRACK,
[videoTrackPackage],
this._engine.irisClientManager.irisClientList
Expand Down

0 comments on commit de58d8d

Please sign in to comment.