From c3bb8653ea13e6defc3734a0b83006c52e80872c Mon Sep 17 00:00:00 2001 From: xucz Date: Thu, 16 Nov 2023 17:23:31 +0800 Subject: [PATCH] Dev/4.2.6 (#364) * update CI * [Android]remove duplicate foreground notification of screen sharing. * [Android]update rtc sdk version to 4.2.6 and etc. * update CI * [Windows]update rtc sdk version to 4.2.6. * update ios script add sdk version * update script * update script * update script * update script * update script * [Android]Update echo test api. * fix change role bug * fix change role bug * update screen share bug * [Winodws]fix some crashes(NMS-17129/NMS-17191) * update sdk version to 4.2.6 --------- Co-authored-by: zhaoyongqiang --- .github/ci/build/build_ios_ipa.sh | 9 ++- .github/ci/build/build_mac.sh | 1 - .github/ci/build/build_mac_ipa.sh | 7 +- Android/APIExample-Audio/app/build.gradle | 2 +- .../examples/advanced/PreCallTest.java | 10 ++- .../gradle/wrapper/gradle-wrapper.properties | 4 +- Android/APIExample/app/build.gradle | 2 +- .../app/src/main/AndroidManifest.xml | 10 --- .../examples/advanced/PreCallTest.java | 10 ++- .../examples/advanced/ScreenSharing.java | 79 ------------------- .../advanced/SwitchCameraScreenShare.java | 77 ------------------ .../gradle/wrapper/gradle-wrapper.properties | 4 +- iOS/APIExample-Audio/Podfile | 2 +- .../SampleHandler.m | 34 ++------ iOS/APIExample-OC/Podfile | 6 +- .../SampleHandler.swift | 27 ++----- iOS/APIExample/Podfile | 6 +- .../LiveStreaming/LiveStreaming.swift | 6 +- .../Advanced/SimpleFilter/SimpleFilter.swift | 12 ++- .../JoinChannelAudio/JoinChannelAudio.swift | 6 +- .../JoinChannelVideoRecorder.swift | 16 +++- .../JoinChannelVideoToken.swift | 16 +++- .../JoinChannelVideo/JoinChannelVideo.swift | 16 +++- macOS/Podfile | 4 +- .../AudioMixing/CAgoraAudioMixingDlg.cpp | 6 +- .../AudioProfile/CAgoraAudioProfile.cpp | 6 +- .../AudioVolume/CAgoraAudioVolumeDlg.cpp | 6 +- .../APIExample/Advanced/Beauty/CDlgBeauty.cpp | 22 +++++- .../APIExample/Advanced/Beauty/CDlgBeauty.h | 1 + .../BeautyAudio/CAgoraBeautyAudio.cpp | 6 +- .../CAgoraCaptureAudioDlg.cpp | 12 ++- .../CustomEncrypt/CAgoraCustomEncryptDlg.cpp | 6 +- .../CLocalVideoTranscodingDlg.cpp | 6 +- .../MediaEncrypt/CAgoraMediaEncryptDlg.cpp | 6 +- .../MediaPlayer/CAgoraMediaPlayer.cpp | 6 +- .../MediaRecorder/CAgoraMediaRecorder.cpp | 6 +- .../MultiChannel/CAgoraMultiChannelDlg.cpp | 6 +- .../CAgoraMutilVideoSourceDlg.cpp | 6 +- .../MultiVideoSourceTracks.cpp | 6 +- .../OriginalAudio/CAgoraOriginalAudioDlg.cpp | 6 +- .../OriginalVideo/CAgoraOriginalVideoDlg.cpp | 6 +- .../PreCallTest/CAgoraPreCallTestDlg.cpp | 34 ++++++-- .../PreCallTest/CAgoraPreCallTestDlg.h | 1 + .../PushExternalVideoYUV.cpp | 12 ++- .../PushExternalVideoYUV.h | 2 +- .../RTMPStream/AgoraRtmpStreaming.cpp | 6 +- .../RegionConn/CAgoraRegionConnDlg.cpp | 6 +- .../ScreenShare/AgoraScreenCapture.cpp | 10 ++- .../SpatialAudio/CAgoraSpatialAudioDlg.cpp | 18 +++-- .../SpatialAudio/CAgoraSpatialAudioDlg.h | 6 +- .../VideoMetadata/CAgoraMetaDataDlg.cpp | 6 +- .../LiveBroadcasting/CLiveBroadcastingDlg.cpp | 6 +- windows/APIExample/install.ps1 | 2 +- 53 files changed, 276 insertions(+), 318 deletions(-) diff --git a/.github/ci/build/build_ios_ipa.sh b/.github/ci/build/build_ios_ipa.sh index 71f5f191e..7badd7a4d 100755 --- a/.github/ci/build/build_ios_ipa.sh +++ b/.github/ci/build/build_ios_ipa.sh @@ -142,17 +142,18 @@ cd ${WORKSPACE} # sh sign "${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --type xcarchive --plist "${PLIST_PATH}" sh export "${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --plist "${PLIST_PATH}" +SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5) # 上传IPA -PAYLOAD_PATH="${TARGET_NAME}_${BUILD_NUMBER}_Payload" +PAYLOAD_PATH="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}_Payload" mkdir "${PAYLOAD_PATH}" # mv "${TARGET_NAME}_${BUILD_NUMBER}_iOS.ipa" "${PAYLOAD_PATH}" mv "${TARGET_NAME}_${BUILD_NUMBER}.ipa" "${PAYLOAD_PATH}" -7za a "${TARGET_NAME}_${BUILD_NUMBER}_IPA.zip" -r "${PAYLOAD_PATH}" -python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_${BUILD_NUMBER}_IPA.zip" --project +7za a "${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}_IPA.zip" -r "${PAYLOAD_PATH}" +python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}_IPA.zip" --project # 删除IPA文件夹 -rm -rf ${TARGET_NAME}_${BUILD_NUMBER}.xcarchive +rm -rf ${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.xcarchive rm -rf *.zip rm -rf ${PAYLOAD_PATH} diff --git a/.github/ci/build/build_mac.sh b/.github/ci/build/build_mac.sh index 1ba0323f4..9a2e0deeb 100644 --- a/.github/ci/build/build_mac.sh +++ b/.github/ci/build/build_mac.sh @@ -81,5 +81,4 @@ if [ $is_generate_validate_app = true ]; then fi 7za a -tzip result.zip -r $unzip_name -# 7za a -tzip result.zip -r Agora_Native_SDK_for_Mac_FULL cp result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name diff --git a/.github/ci/build/build_mac_ipa.sh b/.github/ci/build/build_mac_ipa.sh index 21e5b2125..7c295439c 100755 --- a/.github/ci/build/build_mac_ipa.sh +++ b/.github/ci/build/build_mac_ipa.sh @@ -68,6 +68,8 @@ xcodebuild clean -workspace "${APP_PATH}" -configuration "${CONFIGURATION}" -sch # 时间戳 CURRENT_TIME=$(date "+%Y-%m-%d %H-%M-%S") +SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5) + # 归档路径 ARCHIVE_PATH="${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}.xcarchive" # 编译环境 @@ -88,8 +90,11 @@ cd ${WORKSPACE} # 签名 sh sign "${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}.xcarchive.zip" --type xcarchive --plist "${PLIST_PATH}" --application macApp +# 重命名 +cp "${TARGET_NAME}_${BUILD_NUMBER}.app.zip" "${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.app.zip" + # 上传IPA -python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_${BUILD_NUMBER}.app.zip" --project +python3 artifactory_utils.py --action=upload_file --file="${TARGET_NAME}_SDK_${SDK_VERSION}_CI_${BUILD_NUMBER}.app.zip" --project # 删除archive文件 rm -rf ${TARGET_NAME}_${BUILD_NUMBER}.xcarchive diff --git a/Android/APIExample-Audio/app/build.gradle b/Android/APIExample-Audio/app/build.gradle index 2a09cec4f..ccccf79d4 100644 --- a/Android/APIExample-Audio/app/build.gradle +++ b/Android/APIExample-Audio/app/build.gradle @@ -48,7 +48,7 @@ dependencies { implementation fileTree(dir: "${localSdkPath}", include: ['*.jar', '*.aar']) } else{ - def agora_sdk_version = "4.2.3" + def agora_sdk_version = "4.2.6" // case 1: full single lib with voice only implementation "io.agora.rtc:voice-sdk:${agora_sdk_version}" // case 2: partial libs with voice only diff --git a/Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java b/Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java index 7f187e113..faee2efad 100644 --- a/Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java +++ b/Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java @@ -15,6 +15,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import java.util.Random; import java.util.Timer; import java.util.TimerTask; @@ -24,6 +25,7 @@ import io.agora.api.example.common.BaseFragment; import io.agora.api.example.common.model.StatisticsInfo; import io.agora.rtc2.Constants; +import io.agora.rtc2.EchoTestConfiguration; import io.agora.rtc2.IRtcEngineEventHandler; import io.agora.rtc2.RtcEngine; import io.agora.rtc2.RtcEngineConfig; @@ -159,7 +161,13 @@ public void onClick(View v) { } else if (v.getId() == R.id.btn_echo){ num = 0; - engine.startEchoTest(MAX_COUNT_DOWN); + engine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER); + EchoTestConfiguration config = new EchoTestConfiguration(); + config.enableVideo = false; + config.enableAudio = true; + config.intervalInSeconds = MAX_COUNT_DOWN; + config.channelId = (new Random().nextInt(10000) + 100000) + ""; + engine.startEchoTest(config); btn_echo.setEnabled(false); btn_echo.setText("Recording on Microphone ..."); echoTimer = new Timer(true); diff --git a/Android/APIExample-Audio/gradle/wrapper/gradle-wrapper.properties b/Android/APIExample-Audio/gradle/wrapper/gradle-wrapper.properties index 04180faf8..89d7ee3b3 100644 --- a/Android/APIExample-Audio/gradle/wrapper/gradle-wrapper.properties +++ b/Android/APIExample-Audio/gradle/wrapper/gradle-wrapper.properties @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip -# distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip +#distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip diff --git a/Android/APIExample/app/build.gradle b/Android/APIExample/app/build.gradle index 8974ec03b..5a38f0484 100644 --- a/Android/APIExample/app/build.gradle +++ b/Android/APIExample/app/build.gradle @@ -62,7 +62,7 @@ dependencies { implementation fileTree(dir: "${localSdkPath}", include: ['*.jar', '*.aar']) } else{ - def agora_sdk_version = "4.2.3" + def agora_sdk_version = "4.2.6" // case 1: full libs implementation "io.agora.rtc:full-sdk:${agora_sdk_version}" implementation "io.agora.rtc:full-screen-sharing:${agora_sdk_version}" diff --git a/Android/APIExample/app/src/main/AndroidManifest.xml b/Android/APIExample/app/src/main/AndroidManifest.xml index fcc3933c2..9a95d9d52 100644 --- a/Android/APIExample/app/src/main/AndroidManifest.xml +++ b/Android/APIExample/app/src/main/AndroidManifest.xml @@ -46,16 +46,6 @@ - - - - = Build.VERSION_CODES.Q) { - fgServiceIntent = new Intent(getActivity(), ScreenSharing.MediaProjectFgService.class); - } try { RtcEngineConfig config = new RtcEngineConfig(); /** @@ -176,9 +161,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { @Override public void onDestroy() { - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - getActivity().stopService(fgServiceIntent); - } /**leaveChannel and Destroy the RtcEngine instance*/ if (engine != null) { engine.leaveChannel(); @@ -285,10 +267,6 @@ private void joinChannel(String channelId) { /**Set up to play remote sound with receiver*/ engine.setDefaultAudioRoutetoSpeakerphone(true); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - getActivity().startForegroundService(fgServiceIntent); - } - DisplayMetrics metrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getRealMetrics(metrics); screenCaptureParameters.captureVideo = true; @@ -490,9 +468,6 @@ private void leaveChannel() { fl_remote.removeAllViews(); remoteUid = myUid = -1; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - getActivity().stopService(fgServiceIntent); - } engine.leaveChannel(); engine.stopScreenCapture(); engine.stopPreview(); @@ -531,58 +506,4 @@ public void onNothingSelected(AdapterView parent) { } - public static class MediaProjectFgService extends Service { - @Nullable - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public void onCreate() { - super.onCreate(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - createNotificationChannel(); - } - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - return START_NOT_STICKY; - } - - @Override - public void onDestroy() { - super.onDestroy(); - stopForeground(true); - } - - @RequiresApi(api = Build.VERSION_CODES.O) - private void createNotificationChannel() { - CharSequence name = getString(R.string.app_name); - String description = "Notice that we are trying to capture the screen!!"; - int importance = NotificationManager.IMPORTANCE_HIGH; - String channelId = "agora_channel_mediaproject"; - NotificationChannel channel = new NotificationChannel(channelId, name, importance); - channel.setDescription(description); - channel.enableLights(true); - channel.setLightColor(Color.RED); - channel.enableVibration(true); - channel.setVibrationPattern( - new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); - NotificationManager notificationManager = (NotificationManager) - getSystemService(Context.NOTIFICATION_SERVICE); - notificationManager.createNotificationChannel(channel); - int notifyId = 1; - // Create a notification and set the notification channel. - Notification notification = new NotificationCompat.Builder(this, channelId) - .setContentText(name + "正在录制屏幕内容...") - .setSmallIcon(R.mipmap.ic_launcher) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)) - .setChannelId(channelId) - .setWhen(System.currentTimeMillis()) - .build(); - startForeground(notifyId, notification); - } - } } diff --git a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/SwitchCameraScreenShare.java b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/SwitchCameraScreenShare.java index 664e06b10..79ec44673 100644 --- a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/SwitchCameraScreenShare.java +++ b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/SwitchCameraScreenShare.java @@ -6,17 +6,9 @@ import static io.agora.rtc2.video.VideoEncoderConfiguration.STANDARD_BITRATE; import static io.agora.rtc2.video.VideoEncoderConfiguration.VD_640x360; -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.Service; import android.content.Context; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.graphics.Color; import android.os.Build; import android.os.Bundle; -import android.os.IBinder; import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; @@ -31,8 +23,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; -import androidx.core.app.NotificationCompat; import com.yanzhenjie.permission.AndPermission; import com.yanzhenjie.permission.runtime.Permission; @@ -78,7 +68,6 @@ public class SwitchCameraScreenShare extends BaseFragment implements View.OnClic private boolean joined = false; private int curRenderMode = RENDER_MODE_HIDDEN; private ChannelMediaOptions options = new ChannelMediaOptions(); - private Intent fgServiceIntent; private RtcEngineEx engine; private RtcConnection rtcConnection2 = new RtcConnection(); @@ -114,9 +103,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { if (context == null) { return; } - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - fgServiceIntent = new Intent(getActivity(), MediaProjectFgService.class); - } try { RtcEngineConfig config = new RtcEngineConfig(); /** @@ -168,9 +154,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { @Override public void onDestroy() { - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - getActivity().stopService(fgServiceIntent); - } /**leaveChannel and Destroy the RtcEngine instance*/ if (engine != null) { if(camera.isChecked()){ @@ -190,9 +173,6 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (compoundButton.getId() == R.id.screenShare) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { if(b){ - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - getActivity().startForegroundService(fgServiceIntent); - } DisplayMetrics metrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getRealMetrics(metrics); ScreenCaptureParameters parameters = new ScreenCaptureParameters(); @@ -211,9 +191,6 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) { else{ // stop screen capture and update options engine.stopScreenCapture(); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - getActivity().stopService(fgServiceIntent); - } options.publishScreenCaptureVideo = false; engine.updateChannelMediaOptions(options); } @@ -530,58 +507,4 @@ public void onUserOffline(int uid, int reason) { } }; - public static class MediaProjectFgService extends Service { - @Nullable - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public void onCreate() { - super.onCreate(); - if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) { - createNotificationChannel(); - } - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - return START_NOT_STICKY; - } - - @Override - public void onDestroy() { - super.onDestroy(); - stopForeground(true); - } - - @RequiresApi(api = Build.VERSION_CODES.O) - private void createNotificationChannel() { - CharSequence name = getString(R.string.app_name); - String description = "Notice that we are trying to capture the screen!!"; - int importance = NotificationManager.IMPORTANCE_HIGH; - String channelId = "agora_channel_mediaproject"; - NotificationChannel channel = new NotificationChannel(channelId, name, importance); - channel.setDescription(description); - channel.enableLights(true); - channel.setLightColor(Color.RED); - channel.enableVibration(true); - channel.setVibrationPattern( - new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); - NotificationManager notificationManager = (NotificationManager) - getSystemService(Context.NOTIFICATION_SERVICE); - notificationManager.createNotificationChannel(channel); - int notifyId = 1; - // Create a notification and set the notification channel. - Notification notification = new NotificationCompat.Builder(this, channelId) - .setContentText(name + "正在录制屏幕内容...") - .setSmallIcon(R.mipmap.ic_launcher) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)) - .setChannelId(channelId) - .setWhen(System.currentTimeMillis()) - .build(); - startForeground(notifyId, notification); - } - } } diff --git a/Android/APIExample/gradle/wrapper/gradle-wrapper.properties b/Android/APIExample/gradle/wrapper/gradle-wrapper.properties index 04180faf8..89d7ee3b3 100644 --- a/Android/APIExample/gradle/wrapper/gradle-wrapper.properties +++ b/Android/APIExample/gradle/wrapper/gradle-wrapper.properties @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip -# distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip +#distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.3.3-bin.zip diff --git a/iOS/APIExample-Audio/Podfile b/iOS/APIExample-Audio/Podfile index d3998c2da..9ad892601 100644 --- a/iOS/APIExample-Audio/Podfile +++ b/iOS/APIExample-Audio/Podfile @@ -7,7 +7,7 @@ target 'APIExample-Audio' do pod 'Floaty', '~> 4.2.0' pod 'AGEVideoLayout', '~> 1.0.2' - pod 'AgoraAudio_iOS', '4.2.3' + pod 'AgoraAudio_iOS', '4.2.6' # pod 'sdk', :path => 'sdk.podspec' end diff --git a/iOS/APIExample-OC/Agora-ScreenShare-Extension-OC/SampleHandler.m b/iOS/APIExample-OC/Agora-ScreenShare-Extension-OC/SampleHandler.m index 694363e6a..c69133eb6 100644 --- a/iOS/APIExample-OC/Agora-ScreenShare-Extension-OC/SampleHandler.m +++ b/iOS/APIExample-OC/Agora-ScreenShare-Extension-OC/SampleHandler.m @@ -8,7 +8,7 @@ #import "SampleHandler.h" -@interface SampleHandler () +@interface SampleHandler () @end @@ -16,51 +16,29 @@ @implementation SampleHandler - (void)broadcastStartedWithSetupInfo:(NSDictionary *)setupInfo { // User has requested to start the broadcast. Setup info from the UI extension can be supplied but optional. - [[AgoraReplayKitExt shareInstance] start:self]; + [super broadcastStartedWithSetupInfo:setupInfo]; } - (void)broadcastPaused { // User has requested to pause the broadcast. Samples will stop being delivered. NSLog(@"broadcastPaused"); - [[AgoraReplayKitExt shareInstance] pause]; + [super broadcastPaused]; } - (void)broadcastResumed { // User has requested to resume the broadcast. Samples delivery will resume. NSLog(@"broadcastResumed"); - [[AgoraReplayKitExt shareInstance] resume]; + [super broadcastResumed]; } - (void)broadcastFinished { // User has requested to finish the broadcast. NSLog(@"broadcastFinished"); - [[AgoraReplayKitExt shareInstance] stop]; + [super broadcastFinished]; } - (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType { - [[AgoraReplayKitExt shareInstance] pushSampleBuffer:sampleBuffer withType:sampleBufferType]; + [super processSampleBuffer:sampleBuffer withType:sampleBufferType]; } -//- (void)broadcastFinished:(AgoraReplayKitExt * _Nonnull)broadcast reason:(AgoraReplayKitExtReason)reason { -// switch (reason) { -// case AgoraReplayKitExtReasonInitiativeStop: -// { -// NSLog(@"AgoraReplayKitExtReasonInitiativeStop"); -// } -// break; -// case AgoraReplayKitExtReasonConnectFail: -// { -// NSLog(@"AgoraReplayKitExReasonConnectFail"); -// } -// break; -// case AgoraReplayKitExtReasonDisconnect: -// { -// NSLog(@"AgoraReplayKitExReasonDisconnect"); -// } -// break; -// default: -// break; -// } -//} - @end diff --git a/iOS/APIExample-OC/Podfile b/iOS/APIExample-OC/Podfile index efe567678..c7120307e 100644 --- a/iOS/APIExample-OC/Podfile +++ b/iOS/APIExample-OC/Podfile @@ -5,7 +5,7 @@ target 'APIExample-OC' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! - pod 'AgoraRtcEngine_iOS', '4.2.3' + pod 'AgoraRtcEngine_iOS', '4.2.6' # pod 'sdk', :path => 'sdk.podspec' @@ -14,11 +14,11 @@ end target 'Agora-ScreenShare-Extension-OC' do use_frameworks! # pod 'sdk', :path => 'sdk.podspec' -pod 'AgoraRtcEngine_iOS', '4.2.3' +pod 'AgoraRtcEngine_iOS', '4.2.6' end target 'SimpleFilter' do use_frameworks! # pod 'sdk', :path => 'sdk.podspec' - pod 'AgoraRtcEngine_iOS', '4.2.3' + pod 'AgoraRtcEngine_iOS', '4.2.6' end diff --git a/iOS/APIExample/Agora-ScreenShare-Extension/SampleHandler.swift b/iOS/APIExample/Agora-ScreenShare-Extension/SampleHandler.swift index bc4409e87..b1995255b 100644 --- a/iOS/APIExample/Agora-ScreenShare-Extension/SampleHandler.swift +++ b/iOS/APIExample/Agora-ScreenShare-Extension/SampleHandler.swift @@ -8,42 +8,27 @@ import ReplayKit -class SampleHandler: AgoraReplayKitHandler, AgoraReplayKitExtDelegate { +class SampleHandler: AgoraReplayKitHandler { override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) { // User has requested to start the broadcast. Setup info from the UI extension can be supplied but optional. - AgoraReplayKitExt.shareInstance().start(self) + super.broadcastStarted(withSetupInfo: setupInfo) } override func broadcastPaused() { // User has requested to pause the broadcast. Samples will stop being delivered. - AgoraReplayKitExt.shareInstance().pause() + super.broadcastPaused() } override func broadcastResumed() { // User has requested to resume the broadcast. Samples delivery will resume. - AgoraReplayKitExt.shareInstance().resume() + super.broadcastResumed() } override func broadcastFinished() { // User has requested to finish the broadcast. - AgoraReplayKitExt.shareInstance().stop() + super.broadcastFinished() } override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) { - AgoraReplayKitExt.shareInstance().push(sampleBuffer, with: sampleBufferType) - } - - func broadcastFinished(_ broadcast: AgoraReplayKitExt, reason: AgoraReplayKitExtReason) { - switch reason { - case AgoraReplayKitExtReasonInitiativeStop: - print("AgoraReplayKitExtReasonInitiativeStop") - - case AgoraReplayKitExtReasonConnectFail: - print("AgoraReplayKitExReasonConnectFail") - - case AgoraReplayKitExtReasonDisconnect: - print("AgoraReplayKitExReasonDisconnect") - - default: break - } + super.processSampleBuffer(sampleBuffer, with: sampleBufferType) } } diff --git a/iOS/APIExample/Podfile b/iOS/APIExample/Podfile index cfc8e1492..019197643 100644 --- a/iOS/APIExample/Podfile +++ b/iOS/APIExample/Podfile @@ -9,7 +9,7 @@ target 'APIExample' do pod 'AGEVideoLayout', '~> 1.0.2' pod 'CocoaAsyncSocket', '7.6.5' pod 'ijkplayer', '~> 1.1.3' - pod 'AgoraRtcEngine_iOS', '4.2.3' + pod 'AgoraRtcEngine_iOS', '4.2.6' # pod 'sdk', :path => 'sdk.podspec' # pod 'senseLib', :path => 'sense.podspec' # pod 'bytedEffect', :path => 'bytedEffect.podspec' @@ -19,11 +19,11 @@ end target 'Agora-ScreenShare-Extension' do use_frameworks! # pod 'sdk', :path => 'sdk.podspec' - pod 'AgoraRtcEngine_iOS', '4.2.3' + pod 'AgoraRtcEngine_iOS', '4.2.6' end target 'SimpleFilter' do use_frameworks! # pod 'sdk', :path => 'sdk.podspec' - pod 'AgoraRtcEngine_iOS', '4.2.3' + pod 'AgoraRtcEngine_iOS', '4.2.6' end diff --git a/macOS/APIExample/Examples/Advanced/LiveStreaming/LiveStreaming.swift b/macOS/APIExample/Examples/Advanced/LiveStreaming/LiveStreaming.swift index 0aee24074..6bac15747 100644 --- a/macOS/APIExample/Examples/Advanced/LiveStreaming/LiveStreaming.swift +++ b/macOS/APIExample/Examples/Advanced/LiveStreaming/LiveStreaming.swift @@ -286,7 +286,7 @@ class LiveStreamingMain: BaseViewController { @IBOutlet weak var dualStreamTips: NSTextField! @IBAction func onDualStreaming(_ sender: NSSwitch) { dualStreamTips.stringValue = sender.state == .on ? "Opening".localized : "(Default: flow)".localized - agoraKit.enableDualStreamMode(sender.state == .on) + agoraKit.setDualStreamMode(sender.state == .on ? .enableSimulcastStream : .disableSimulcastStream) } @IBOutlet weak var firstFrameSwitch: NSSwitch! @@ -473,10 +473,12 @@ class LiveStreamingMain: BaseViewController { // the view to be binded videoCanvas.view = localVideo.videocanvas videoCanvas.renderMode = .hidden - agoraKit.setupLocalVideo(videoCanvas) // you have to call startPreview to see local video + agoraKit.setupLocalVideo(videoCanvas) if role == .broadcaster { agoraKit.startPreview() + } else { + agoraKit.stopPreview() } // start joining channel diff --git a/macOS/APIExample/Examples/Advanced/SimpleFilter/SimpleFilter.swift b/macOS/APIExample/Examples/Advanced/SimpleFilter/SimpleFilter.swift index 9fc6bdf4b..a4ee6df8c 100644 --- a/macOS/APIExample/Examples/Advanced/SimpleFilter/SimpleFilter.swift +++ b/macOS/APIExample/Examples/Advanced/SimpleFilter/SimpleFilter.swift @@ -238,7 +238,13 @@ class SimpleFilterMain: BaseViewController { selectRolePicker.onSelectChanged { guard let selected = self.selectedRole else { return } if self.isJoined { + let mediaOption = AgoraRtcChannelMediaOptions() + mediaOption.publishCameraTrack = selected == .broadcaster + mediaOption.publishMicrophoneTrack = selected == .broadcaster + mediaOption.clientRoleType = selected + self.agoraKit.updateChannel(with: mediaOption) self.agoraKit.setClientRole(selected) + _ = selected == .broadcaster ? self.agoraKit.startPreview() : self.agoraKit.stopPreview() } } } @@ -371,7 +377,11 @@ class SimpleFilterMain: BaseViewController { videoCanvas.renderMode = .hidden agoraKit.setupLocalVideo(videoCanvas) // you have to call startPreview to see local video - agoraKit.startPreview() + if role == .broadcaster { + agoraKit.startPreview() + } else { + agoraKit.stopPreview() + } // start joining channel // 1. Users can only see each other after they join the diff --git a/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift b/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift index b01e9fe02..f8408f50a 100644 --- a/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift +++ b/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift @@ -40,7 +40,8 @@ class JoinChannelAudioMain: BaseViewController { let scenario = self.selectedAudioScenario else { return } - self.agoraKit.setAudioProfile(profile, scenario: scenario) + self.agoraKit.setAudioProfile(profile) + self.agoraKit.setAudioScenario(scenario) } } @@ -69,7 +70,8 @@ class JoinChannelAudioMain: BaseViewController { let scenario = self.selectedAudioScenario else { return } - self.agoraKit.setAudioProfile(profile, scenario: scenario) + self.agoraKit.setAudioProfile(profile) + self.agoraKit.setAudioScenario(scenario) } } diff --git a/macOS/APIExample/Examples/Basic/JoinChannelVideo(Recorder)/JoinChannelVideoRecorder.swift b/macOS/APIExample/Examples/Basic/JoinChannelVideo(Recorder)/JoinChannelVideoRecorder.swift index b897573cd..95b2f4edd 100644 --- a/macOS/APIExample/Examples/Basic/JoinChannelVideo(Recorder)/JoinChannelVideoRecorder.swift +++ b/macOS/APIExample/Examples/Basic/JoinChannelVideo(Recorder)/JoinChannelVideoRecorder.swift @@ -251,10 +251,16 @@ class JoinChannelVideoRecordMain: BaseViewController { func initSelectRolePicker() { selectRolePicker.label.stringValue = "Role".localized selectRolePicker.picker.addItems(withTitles: roles.map { $0.description() }) - selectRolePicker.onSelectChanged { - guard let selected = self.selectedRole else { return } + selectRolePicker.onSelectChanged { [weak self] in + guard let self = self, let selected = self.selectedRole else { return } if self.isJoined { + let mediaOption = AgoraRtcChannelMediaOptions() + mediaOption.publishCameraTrack = selected == .broadcaster + mediaOption.publishMicrophoneTrack = selected == .broadcaster + mediaOption.clientRoleType = selected + self.agoraKit.updateChannel(with: mediaOption) self.agoraKit.setClientRole(selected) + _ = selected == .broadcaster ? self.agoraKit.startPreview() : self.agoraKit.stopPreview() } } } @@ -421,7 +427,11 @@ class JoinChannelVideoRecordMain: BaseViewController { videoCanvas.renderMode = .hidden agoraKit.setupLocalVideo(videoCanvas) // you have to call startPreview to see local video - agoraKit.startPreview() + if role == .broadcaster { + agoraKit.startPreview() + } else { + agoraKit.stopPreview() + } // start joining channel // 1. Users can only see each other after they join the diff --git a/macOS/APIExample/Examples/Basic/JoinChannelVideo(Token)/JoinChannelVideoToken.swift b/macOS/APIExample/Examples/Basic/JoinChannelVideo(Token)/JoinChannelVideoToken.swift index 2c6fb37ab..29f528c45 100644 --- a/macOS/APIExample/Examples/Basic/JoinChannelVideo(Token)/JoinChannelVideoToken.swift +++ b/macOS/APIExample/Examples/Basic/JoinChannelVideo(Token)/JoinChannelVideoToken.swift @@ -215,10 +215,16 @@ class JoinChannelVideoToken: BaseViewController { func initSelectRolePicker() { selectRolePicker.label.stringValue = "Role".localized selectRolePicker.picker.addItems(withTitles: roles.map { $0.description() }) - selectRolePicker.onSelectChanged { - guard let selected = self.selectedRole else { return } + selectRolePicker.onSelectChanged { [weak self] in + guard let self = self, let selected = self.selectedRole else { return } if self.isJoined { + let mediaOption = AgoraRtcChannelMediaOptions() + mediaOption.publishCameraTrack = selected == .broadcaster + mediaOption.publishMicrophoneTrack = selected == .broadcaster + mediaOption.clientRoleType = selected + self.agoraKit?.updateChannel(with: mediaOption) self.agoraKit?.setClientRole(selected) + _ = selected == .broadcaster ? self.agoraKit?.startPreview() : self.agoraKit?.stopPreview() } } } @@ -355,7 +361,11 @@ class JoinChannelVideoToken: BaseViewController { videoCanvas.renderMode = .hidden agoraKit?.setupLocalVideo(videoCanvas) // you have to call startPreview to see local video - agoraKit?.startPreview() + if role == .broadcaster { + agoraKit?.startPreview() + } else { + agoraKit?.stopPreview() + } // start joining channel // 1. Users can only see each other after they join the diff --git a/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift b/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift index 7bbb6f542..3dfa35328 100644 --- a/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift +++ b/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift @@ -213,10 +213,16 @@ class JoinChannelVideoMain: BaseViewController { func initSelectRolePicker() { selectRolePicker.label.stringValue = "Role".localized selectRolePicker.picker.addItems(withTitles: roles.map { $0.description() }) - selectRolePicker.onSelectChanged { - guard let selected = self.selectedRole else { return } + selectRolePicker.onSelectChanged { [weak self] in + guard let self = self, let selected = self.selectedRole else { return } if self.isJoined { + let mediaOption = AgoraRtcChannelMediaOptions() + mediaOption.publishCameraTrack = selected == .broadcaster + mediaOption.publishMicrophoneTrack = selected == .broadcaster + mediaOption.clientRoleType = selected + self.agoraKit.updateChannel(with: mediaOption) self.agoraKit.setClientRole(selected) + _ = selected == .broadcaster ? self.agoraKit.startPreview() : self.agoraKit.stopPreview() } } } @@ -338,7 +344,11 @@ class JoinChannelVideoMain: BaseViewController { videoCanvas.renderMode = .hidden agoraKit.setupLocalVideo(videoCanvas) // you have to call startPreview to see local video - agoraKit.startPreview() + if role == .broadcaster { + agoraKit.startPreview() + } else { + agoraKit.stopPreview() + } // start joining channel // 1. Users can only see each other after they join the diff --git a/macOS/Podfile b/macOS/Podfile index 0295ed132..ce429cb69 100644 --- a/macOS/Podfile +++ b/macOS/Podfile @@ -4,14 +4,14 @@ target 'APIExample' do use_frameworks! pod 'AGEVideoLayout', '1.0.2' - pod 'AgoraRtcEngine_macOS', '4.2.3' + pod 'AgoraRtcEngine_macOS', '4.2.6' # pod 'sdk', :path => 'sdk.podspec' end target 'SimpleFilter' do use_frameworks! # pod 'sdk', :path => 'sdk.podspec' - pod 'AgoraRtcEngine_macOS', '4.2.3' + pod 'AgoraRtcEngine_macOS', '4.2.6' end diff --git a/windows/APIExample/APIExample/Advanced/AudioMixing/CAgoraAudioMixingDlg.cpp b/windows/APIExample/APIExample/Advanced/AudioMixing/CAgoraAudioMixingDlg.cpp index 1b0c2d7cc..8685da2d4 100755 --- a/windows/APIExample/APIExample/Advanced/AudioMixing/CAgoraAudioMixingDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/AudioMixing/CAgoraAudioMixingDlg.cpp @@ -99,8 +99,10 @@ void CAgoraAudioMixingDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp b/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp index 99f5894d3..956ec9ac3 100644 --- a/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp +++ b/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp @@ -96,8 +96,10 @@ void CAgoraAudioProfile::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/AudioVolume/CAgoraAudioVolumeDlg.cpp b/windows/APIExample/APIExample/Advanced/AudioVolume/CAgoraAudioVolumeDlg.cpp index b1b9ff922..f710936a3 100644 --- a/windows/APIExample/APIExample/Advanced/AudioVolume/CAgoraAudioVolumeDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/AudioVolume/CAgoraAudioVolumeDlg.cpp @@ -117,8 +117,10 @@ void CAgoraAudioVolumeDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.cpp b/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.cpp index a9c80a705..5d8f53b29 100755 --- a/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.cpp +++ b/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.cpp @@ -66,6 +66,7 @@ BEGIN_MESSAGE_MAP(CDlgBeauty, CDialogEx) ON_BN_CLICKED(IDC_CHECK_VIDEO_DENOISE, &CDlgBeauty::OnBnClickedCheckVideoDenoise) ON_BN_CLICKED(IDC_CHECK_VIDEO_DENOISE2, &CDlgBeauty::OnBnClickedCheckVideoDenoise2) ON_BN_CLICKED(IDC_CHECK_LOWLIGHT, &CDlgBeauty::OnBnClickedCheckLowlight) + ON_WM_SHOWWINDOW() ON_CONTROL_RANGE(BN_CLICKED, IDC_RADIO_VIRTUAL_BG_BLUR, IDC_RADIO_VIRTUAL_BG_IMAGE, &CDlgBeauty::OnBnClickedStaticVirtualBgChoose) END_MESSAGE_MAP() @@ -125,6 +126,20 @@ void CDlgBeauty::OnBnClickedButtonJoinchannel() m_joinChannel = !m_joinChannel; } +void CDlgBeauty::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CDialogEx::OnShowWindow(bShow, nStatus); + + if (bShow) { + //init control text. + InitCtrlText(); + } + else { + //resume window status. + ResumeStatus(); + } +} + bool CDlgBeauty::InitAgora() { //create Agora RTC engine @@ -210,8 +225,11 @@ void CDlgBeauty::UnInitAgora() m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("stopPreview")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } + m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.h b/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.h index eb8a11924..ebfa2ca18 100644 --- a/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.h +++ b/windows/APIExample/APIExample/Advanced/Beauty/CDlgBeauty.h @@ -130,4 +130,5 @@ class CDlgBeauty : public CDialogEx afx_msg void OnBnClickedCheckLowlight(); afx_msg void OnBnClickedStaticVirtualBgChoose(UINT idCtl); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); }; diff --git a/windows/APIExample/APIExample/Advanced/BeautyAudio/CAgoraBeautyAudio.cpp b/windows/APIExample/APIExample/Advanced/BeautyAudio/CAgoraBeautyAudio.cpp index eab1e5da6..d99f3930c 100644 --- a/windows/APIExample/APIExample/Advanced/BeautyAudio/CAgoraBeautyAudio.cpp +++ b/windows/APIExample/APIExample/Advanced/BeautyAudio/CAgoraBeautyAudio.cpp @@ -89,8 +89,10 @@ void CAgoraBeautyAudio::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/CustomAudioCapture/CAgoraCaptureAudioDlg.cpp b/windows/APIExample/APIExample/Advanced/CustomAudioCapture/CAgoraCaptureAudioDlg.cpp index 6d1a4b0a7..e9d38a987 100644 --- a/windows/APIExample/APIExample/Advanced/CustomAudioCapture/CAgoraCaptureAudioDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/CustomAudioCapture/CAgoraCaptureAudioDlg.cpp @@ -122,7 +122,7 @@ bool CAgoraCaptureAduioDlg::InitAgora() //initialize the Agora RTC engine context. int ret = m_rtcEngine->initialize(context); - mediaEngine.queryInterface(m_rtcEngine, AGORA_IID_MEDIA_ENGINE); + if (ret != 0) { m_initialize = false; @@ -133,6 +133,8 @@ bool CAgoraCaptureAduioDlg::InitAgora() } else m_initialize = true; + + mediaEngine.queryInterface(m_rtcEngine, AGORA_IID_MEDIA_ENGINE); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("initialize success")); //enable video in the engine. m_rtcEngine->enableVideo(); @@ -170,8 +172,10 @@ void CAgoraCaptureAduioDlg::UnInitAgora() m_agAudioCaptureDevice.Stop(); m_agAudioCaptureDevice.engine_ = NULL; //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } @@ -555,7 +559,7 @@ void CAgoraCaptureAduioDlg::UpdateDevice() nPathLen = MAX_PATH; m_cmbAudioDevice.ResetContent(); //enum audio capture device. - if (m_agAudioCaptureDevice.EnumDeviceList()) + if (m_initialize && m_agAudioCaptureDevice.EnumDeviceList()) { m_agAudioCaptureDevice.GetCurrentDevice(szDevicePath, &nPathLen); for (int nIndex = 0; nIndex < m_agAudioCaptureDevice.GetDeviceCount(); nIndex++) { diff --git a/windows/APIExample/APIExample/Advanced/CustomEncrypt/CAgoraCustomEncryptDlg.cpp b/windows/APIExample/APIExample/Advanced/CustomEncrypt/CAgoraCustomEncryptDlg.cpp index f7bcf0a62..26acb77bc 100755 --- a/windows/APIExample/APIExample/Advanced/CustomEncrypt/CAgoraCustomEncryptDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/CustomEncrypt/CAgoraCustomEncryptDlg.cpp @@ -109,8 +109,10 @@ void CAgoraCustomEncryptDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/LocalVideoTranscoding/CLocalVideoTranscodingDlg.cpp b/windows/APIExample/APIExample/Advanced/LocalVideoTranscoding/CLocalVideoTranscodingDlg.cpp index 29e40aea8..c942eddfd 100755 --- a/windows/APIExample/APIExample/Advanced/LocalVideoTranscoding/CLocalVideoTranscodingDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/LocalVideoTranscoding/CLocalVideoTranscodingDlg.cpp @@ -325,8 +325,10 @@ void CLocalVideoTranscodingDlg::UnInitAgora() m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("stopPreview")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/MediaEncrypt/CAgoraMediaEncryptDlg.cpp b/windows/APIExample/APIExample/Advanced/MediaEncrypt/CAgoraMediaEncryptDlg.cpp index 9037a33e0..6bbf0d102 100755 --- a/windows/APIExample/APIExample/Advanced/MediaEncrypt/CAgoraMediaEncryptDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/MediaEncrypt/CAgoraMediaEncryptDlg.cpp @@ -111,8 +111,10 @@ void CAgoraMediaEncryptDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/MediaPlayer/CAgoraMediaPlayer.cpp b/windows/APIExample/APIExample/Advanced/MediaPlayer/CAgoraMediaPlayer.cpp index 11e62348c..607858e50 100755 --- a/windows/APIExample/APIExample/Advanced/MediaPlayer/CAgoraMediaPlayer.cpp +++ b/windows/APIExample/APIExample/Advanced/MediaPlayer/CAgoraMediaPlayer.cpp @@ -135,8 +135,10 @@ void CAgoraMediaPlayer::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/MediaRecorder/CAgoraMediaRecorder.cpp b/windows/APIExample/APIExample/Advanced/MediaRecorder/CAgoraMediaRecorder.cpp index fbdfbc27f..8845174c0 100755 --- a/windows/APIExample/APIExample/Advanced/MediaRecorder/CAgoraMediaRecorder.cpp +++ b/windows/APIExample/APIExample/Advanced/MediaRecorder/CAgoraMediaRecorder.cpp @@ -134,8 +134,10 @@ void CAgoraMediaRecorder::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/MultiChannel/CAgoraMultiChannelDlg.cpp b/windows/APIExample/APIExample/Advanced/MultiChannel/CAgoraMultiChannelDlg.cpp index 534916376..98795e84a 100755 --- a/windows/APIExample/APIExample/Advanced/MultiChannel/CAgoraMultiChannelDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/MultiChannel/CAgoraMultiChannelDlg.cpp @@ -132,8 +132,10 @@ void CAgoraMultiChannelDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/MultiVideoSource/CAgoraMutilVideoSourceDlg.cpp b/windows/APIExample/APIExample/Advanced/MultiVideoSource/CAgoraMutilVideoSourceDlg.cpp index c4f39dcea..1cd31a2de 100755 --- a/windows/APIExample/APIExample/Advanced/MultiVideoSource/CAgoraMutilVideoSourceDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/MultiVideoSource/CAgoraMutilVideoSourceDlg.cpp @@ -369,8 +369,10 @@ void CAgoraMutilVideoSourceDlg::UnInitAgora() m_rtcEngine->stopPreview(); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/MultiVideoSourceTracks/MultiVideoSourceTracks.cpp b/windows/APIExample/APIExample/Advanced/MultiVideoSourceTracks/MultiVideoSourceTracks.cpp index 0fa7987d8..ea48592e8 100755 --- a/windows/APIExample/APIExample/Advanced/MultiVideoSourceTracks/MultiVideoSourceTracks.cpp +++ b/windows/APIExample/APIExample/Advanced/MultiVideoSourceTracks/MultiVideoSourceTracks.cpp @@ -322,8 +322,10 @@ void MultiVideoSourceTracks::UnInitAgora() m_rtcEngine->stopPreview(); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/OriginalAudio/CAgoraOriginalAudioDlg.cpp b/windows/APIExample/APIExample/Advanced/OriginalAudio/CAgoraOriginalAudioDlg.cpp index 8ae0b2fdf..13f15d4d7 100755 --- a/windows/APIExample/APIExample/Advanced/OriginalAudio/CAgoraOriginalAudioDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/OriginalAudio/CAgoraOriginalAudioDlg.cpp @@ -226,8 +226,10 @@ void CAgoraOriginalAudioDlg::UnInitAgora() bRegisterEncoded = false; } //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/OriginalVideo/CAgoraOriginalVideoDlg.cpp b/windows/APIExample/APIExample/Advanced/OriginalVideo/CAgoraOriginalVideoDlg.cpp index 275254d64..52b108f72 100755 --- a/windows/APIExample/APIExample/Advanced/OriginalVideo/CAgoraOriginalVideoDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/OriginalVideo/CAgoraOriginalVideoDlg.cpp @@ -83,8 +83,10 @@ void CAgoraOriginalVideoDlg::UnInitAgora() m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); RegisterVideoFrameObserver(FALSE); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp index 00d30c2ff..a093fed4e 100755 --- a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp @@ -82,7 +82,16 @@ bool CAgoraPreCallTestDlg::InitAgora() context.eventHandler = &m_eventHandler; //initialize the Agora RTC engine context. int ret = m_rtcEngine->initialize(context); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("initialize rtc engine")); + if (ret != 0) { + m_initialize = false; + CString strInfo; + strInfo.Format(_T("initialize failed: %d"), ret); + m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo); + return false; + } + else + m_initialize = true; + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("initialize success")); LastmileProbeConfig config; config.probeUplink = true; config.probeDownlink = true; @@ -106,14 +115,22 @@ bool CAgoraPreCallTestDlg::InitAgora() void CAgoraPreCallTestDlg::UnInitAgora() { if (m_rtcEngine) { - //release device manager. - m_audioDeviceManager->release(); - m_videoDeviceManager->release(); + m_rtcEngine->stopLastmileProbeTest(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("stopLastmileProbeTest")); - //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + + if (m_initialize) { + //release device manager. + m_audioDeviceManager->release(); + m_videoDeviceManager->release(); + + //release engine. + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } + + m_audioDeviceManager = NULL; + m_videoDeviceManager = NULL; m_rtcEngine = NULL; } } @@ -146,6 +163,9 @@ void CAgoraPreCallTestDlg::UpdateViews() m_cmbAudioInput.ResetContent(); m_cmbAudioOutput.ResetContent(); m_cmbVideo.ResetContent(); + if (!m_initialize) { + return; + } int nVol; (*m_audioDeviceManager)->getPlaybackDeviceVolume(&nVol); m_sldAudioOutputVol.SetPos(nVol); diff --git a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h index 0ab105f28..9499b30b7 100644 --- a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h +++ b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h @@ -99,6 +99,7 @@ class CAgoraPreCallTestDlg : public CDialogEx bool m_audioInputTest; bool m_audioOutputTest; bool m_cameraTest; + bool m_initialize; protected: virtual void DoDataExchange(CDataExchange* pDX); diff --git a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp index a5a8d6955..977f862a6 100755 --- a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp +++ b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp @@ -120,7 +120,11 @@ void PushExternalVideoYUV::UnInitAgora() { if (m_rtcEngine) { yuvReader.stop(); - delete m_imgBuffer; + if (m_imgBuffer) { + delete m_imgBuffer; + m_imgBuffer = nullptr; + } + if (m_joinChannel) m_joinChannel = !m_rtcEngine->leaveChannel(); @@ -134,8 +138,10 @@ void PushExternalVideoYUV::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h index 0fbb9a409..c44640556 100755 --- a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h +++ b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h @@ -123,7 +123,7 @@ class PushExternalVideoYUV : public CDialogEx agora::util::AutoPtr m_mediaEngine; bool m_joinChannel = false; bool m_initialize = false; - BYTE* m_imgBuffer; + BYTE* m_imgBuffer = nullptr; DECLARE_MESSAGE_MAP() diff --git a/windows/APIExample/APIExample/Advanced/RTMPStream/AgoraRtmpStreaming.cpp b/windows/APIExample/APIExample/Advanced/RTMPStream/AgoraRtmpStreaming.cpp index b1e3c5089..ed2712fae 100755 --- a/windows/APIExample/APIExample/Advanced/RTMPStream/AgoraRtmpStreaming.cpp +++ b/windows/APIExample/APIExample/Advanced/RTMPStream/AgoraRtmpStreaming.cpp @@ -248,8 +248,10 @@ void CAgoraRtmpStreamingDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/RegionConn/CAgoraRegionConnDlg.cpp b/windows/APIExample/APIExample/Advanced/RegionConn/CAgoraRegionConnDlg.cpp index ed5d2fd25..fa9d1963b 100644 --- a/windows/APIExample/APIExample/Advanced/RegionConn/CAgoraRegionConnDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/RegionConn/CAgoraRegionConnDlg.cpp @@ -167,8 +167,10 @@ void CAgoraRegionConnDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp b/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp index d4f9a87e5..153bcc58c 100755 --- a/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp +++ b/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp @@ -123,8 +123,10 @@ void CAgoraScreenCapture::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; if (m_screenParam.excludeWindowList != nullptr) { delete[] m_screenParam.excludeWindowList; @@ -352,7 +354,9 @@ void CAgoraScreenCapture::OnBnClickedButtonStartShare() if (!m_rtcEngine || !m_initialize) return; HWND hWnd = NULL; - //if (m_cmbScreenCap.GetCurSel() != m_cmbScreenCap.GetCount() - 1) + if (m_cmbScreenCap.GetCurSel() < 0 || m_cmbScreenCap.GetCurSel() >= m_listWnd.GetSize()) { + return; + } hWnd = (HWND)m_listWnd.GetAt(m_listWnd.FindIndex(m_cmbScreenCap.GetCurSel())).sourceId; int ret = 0; m_windowShare = !m_windowShare; diff --git a/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.cpp b/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.cpp index 27551f910..581b4a3c5 100755 --- a/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.cpp @@ -185,10 +185,14 @@ bool CAgoraSpatialAudioDlg::InitAgora() void CAgoraSpatialAudioDlg::UnInitAgora() { if (m_rtcEngine) { - m_mediaPlayerLeft->stop(); - m_mediaPlayerLeft = nullptr; - m_mediaPlayerRight->stop(); - m_mediaPlayerRight = nullptr; + if (m_mediaPlayerLeft) { + m_mediaPlayerLeft->stop(); + m_mediaPlayerLeft = nullptr; + } + if (m_mediaPlayerRight) { + m_mediaPlayerRight->stop(); + m_mediaPlayerRight = nullptr; + } m_localSpatial = nullptr; if (m_joinChannel) @@ -201,8 +205,10 @@ void CAgoraSpatialAudioDlg::UnInitAgora() m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableAudio")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.h b/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.h index fdd870bf5..bddf8ef44 100755 --- a/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.h +++ b/windows/APIExample/APIExample/Advanced/SpatialAudio/CAgoraSpatialAudioDlg.h @@ -253,10 +253,10 @@ class CAgoraSpatialAudioDlg : public CDialogEx bool m_SpatialAudio = false; IRtcEngine* m_rtcEngine = nullptr; - ILocalSpatialAudioEngine* m_localSpatial; - IMediaPlayer* m_mediaPlayerLeft; + ILocalSpatialAudioEngine* m_localSpatial = nullptr; + IMediaPlayer* m_mediaPlayerLeft = nullptr; CSpatialAudioPlayerObserver playerLeftObserver; - IMediaPlayer* m_mediaPlayerRight; + IMediaPlayer* m_mediaPlayerRight = nullptr; CSpatialAudioPlayerObserver playerRightObserver; CSpatialAudioEventHandler m_eventHandler; diff --git a/windows/APIExample/APIExample/Advanced/VideoMetadata/CAgoraMetaDataDlg.cpp b/windows/APIExample/APIExample/Advanced/VideoMetadata/CAgoraMetaDataDlg.cpp index 3c1f81ec0..a0b317209 100755 --- a/windows/APIExample/APIExample/Advanced/VideoMetadata/CAgoraMetaDataDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/VideoMetadata/CAgoraMetaDataDlg.cpp @@ -340,8 +340,10 @@ void CAgoraMetaDataDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.cpp b/windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.cpp index a40098a81..d0af2c34c 100755 --- a/windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.cpp +++ b/windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.cpp @@ -370,8 +370,10 @@ void CLiveBroadcastingDlg::UnInitAgora() m_rtcEngine->disableVideo(); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("disableVideo")); //release engine. - m_rtcEngine->release(true); - m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + if (m_initialize) { + m_rtcEngine->release(true); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("release rtc engine")); + } m_rtcEngine = NULL; } } diff --git a/windows/APIExample/install.ps1 b/windows/APIExample/install.ps1 index d41efaf73..c30260c71 100644 --- a/windows/APIExample/install.ps1 +++ b/windows/APIExample/install.ps1 @@ -1,6 +1,6 @@ $ThirdPartysrc = 'https://download.agora.io/staging/ThirdParty.zip' $ThirdPartydes = 'ThirdParty.zip' -$agora_sdk = 'https://download.agora.io/sdk/release/Agora_Native_SDK_for_Windows_v4.2.3_FULL.zip' +$agora_sdk = 'https://download.agora.io/sdk/release/Agora_Native_SDK_for_Windows_v4.2.6_FULL.zip' $agora_des = 'AgoraSdk.zip' $agora_local_sdk = '../../sdk'