Skip to content

Commit 355c28b

Browse files
committed
fix: fix bugs
1 parent 360802e commit 355c28b

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

windows/APIExample/APIExample/Advanced/RealTimeLiveBroadcasting/CAgoraRealtimeLiveBroadcastingDlg.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ BEGIN_MESSAGE_MAP(CAgoraRealtimeLiveBroadcastingDlg, CDialogEx)
165165
ON_MESSAGE(WM_MSGID(EID_LOCAL_VIDEO_STATE_CHANGED), &CAgoraRealtimeLiveBroadcastingDlg::onEIDLocalVideoStateChanged)
166166
ON_MESSAGE(WM_MSGID(EID_REMOTE_VIDEO_STATS), &CAgoraRealtimeLiveBroadcastingDlg::onEIDRemoteVideoStats)
167167
ON_MESSAGE(WM_MSGID(EID_CONTENT_INSPECT_RESULT), &CAgoraRealtimeLiveBroadcastingDlg::onEIDContentInsepctResult)
168+
ON_MESSAGE(WM_MSGID(EID_SUPER_RESOLUTION_ENABLED), &CAgoraRealtimeLiveBroadcastingDlg::onEIDSuperResolutionEnabled)
168169
ON_BN_CLICKED(IDC_CHECK_REPORT, &CAgoraRealtimeLiveBroadcastingDlg::OnBnClickedCheckReport)
169170
ON_CBN_SELCHANGE(IDC_COMBO_COLOR, &CAgoraRealtimeLiveBroadcastingDlg::OnSelchangeComboColor)
170171
ON_BN_CLICKED(IDC_CHECK_MODERATION, &CAgoraRealtimeLiveBroadcastingDlg::OnBnClickedModeration)
@@ -542,6 +543,7 @@ LRESULT CAgoraRealtimeLiveBroadcastingDlg::OnEIDLeaveChannel(WPARAM wParam, LPAR
542543
return 0;
543544
}
544545

546+
545547
LRESULT CAgoraRealtimeLiveBroadcastingDlg::OnEIDUserJoined(WPARAM wParam, LPARAM lParam)
546548
{
547549
if (m_lstUids.size() == m_maxVideoCount)
@@ -560,6 +562,7 @@ LRESULT CAgoraRealtimeLiveBroadcastingDlg::OnEIDUserJoined(WPARAM wParam, LPARAM
560562
m_videoWnds[i].SetUID(wParam);
561563
//setup remote video in engine to the canvas.
562564
m_rtcEngine->setupRemoteVideo(canvas);
565+
m_rtcEngine->enableRemoteSuperResolution(wParam, m_superResolution);
563566
break;
564567
}
565568
}
@@ -935,6 +938,7 @@ LRESULT CAgoraRealtimeLiveBroadcastingDlg::onEIDRtcStats(WPARAM wParam, LPARAM l
935938
}
936939

937940
LRESULT CAgoraRealtimeLiveBroadcastingDlg::onEIDLocalAudioStats(WPARAM wParam, LPARAM lParam) {
941+
938942
LocalAudioStats* stats = (LocalAudioStats*)wParam;
939943
CString strInfo = _T("===onLocalAudioStats===");
940944
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
@@ -954,6 +958,7 @@ LRESULT CAgoraRealtimeLiveBroadcastingDlg::onEIDLocalAudioStats(WPARAM wParam, L
954958
delete stats;
955959
stats = nullptr;
956960
}
961+
957962
return 0;
958963
}
959964

@@ -1147,6 +1152,17 @@ LRESULT CAgoraRealtimeLiveBroadcastingDlg::onEIDContentInsepctResult(WPARAM wPar
11471152
return 0;
11481153
}
11491154

1155+
LRESULT CAgoraRealtimeLiveBroadcastingDlg::onEIDSuperResolutionEnabled(WPARAM wParam, LPARAM lParam) {
1156+
CString strInfo = _T("===onEIDSuperResolutionEnabled===");
1157+
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
1158+
agora::rtc::uid_t uid = (agora::rtc::uid_t)wParam;
1159+
SUPER_RESOLUTION_STATE_REASON reason = (SUPER_RESOLUTION_STATE_REASON)lParam;
1160+
1161+
strInfo.Format(_T("uid:%d reason:%d"), uid, reason);
1162+
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
1163+
return 0;
1164+
}
1165+
11501166
void CAgoraRealtimeLiveBroadcastingDlg::OnBnClickedCheckReport()
11511167
{
11521168
m_eventHandler.SetReport(m_chkReport.GetCheck() != 0);
@@ -1180,4 +1196,9 @@ void CAgoraRealtimeLiveBroadcastingDlg::OnSelchangeComboColor()
11801196
void CAgoraRealtimeLiveBroadcastingDlg::OnCbnSelchangeComboSr()
11811197
{
11821198
m_superResolution = (m_cmbSR.GetCurSel() != 0);
1199+
for (auto iter = m_lstUids.begin();
1200+
iter != m_lstUids.end(); iter++) {
1201+
agora::rtc::uid_t uid = *iter;
1202+
m_rtcEngine->enableRemoteSuperResolution(uid, m_superResolution);
1203+
}
11831204
}

windows/APIExample/APIExample/Advanced/RealTimeLiveBroadcasting/CAgoraRealtimeLiveBroadcastingDlg.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class CAgoraRealtimeLiveBroadcastingRtcEngineEventHandler
9797
LocalAudioStats* s = new LocalAudioStats;
9898
*s = stats;
9999
::PostMessage(m_hMsgHanlder, WM_MSGID(EID_LOCAL_AUDIO_STATS), (WPARAM)s, 0);
100-
101100
}
102101
}
103102

@@ -109,10 +108,11 @@ class CAgoraRealtimeLiveBroadcastingRtcEngineEventHandler
109108

110109
virtual void onRemoteAudioStats(const RemoteAudioStats& stats) {
111110
if (m_hMsgHanlder&& report) {
111+
112112
RemoteAudioStats* s = new RemoteAudioStats;
113113
*s = stats;
114114
::PostMessage(m_hMsgHanlder, WM_MSGID(EID_REMOTE_AUDIO_STATS), (WPARAM)s, 0);
115-
115+
116116
}
117117
}
118118

@@ -167,6 +167,12 @@ class CAgoraRealtimeLiveBroadcastingRtcEngineEventHandler
167167
::PostMessage(m_hMsgHanlder, WM_MSGID(EID_CONTENT_INSPECT_RESULT), (WPARAM)result, 0);
168168
}
169169
}
170+
171+
virtual void onUserSuperResolutionEnabled(uid_t uid, bool enabled, SUPER_RESOLUTION_STATE_REASON reason) {
172+
if (m_hMsgHanlder) {
173+
::PostMessage(m_hMsgHanlder, WM_MSGID(EID_SUPER_RESOLUTION_ENABLED), (WPARAM)uid, (LPARAM)reason);
174+
}
175+
}
170176

171177
void SetReport(bool b) { report = b; }
172178
private:
@@ -224,6 +230,7 @@ class CAgoraRealtimeLiveBroadcastingDlg : public CDialogEx
224230
afx_msg LRESULT onEIDRemoteVideoStats(WPARAM wParam, LPARAM lParam);
225231
afx_msg LRESULT onEIDRemoteVideoStateChanged(WPARAM wParam, LPARAM lParam);
226232
afx_msg LRESULT onEIDContentInsepctResult(WPARAM wParam, LPARAM lParam);
233+
afx_msg LRESULT onEIDSuperResolutionEnabled(WPARAM wParam, LPARAM lParam);
227234
private:
228235
//set control text from config.
229236
void InitCtrlText();

windows/APIExample/APIExample/stdafx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ using namespace agora::media;
9191
#define EID_SCREEN_CAPTURE_INFO_UPDATED 0x00000021
9292
#define EID_AUDIO_VOLUME_TEST_INDICATION 0x00000022
9393
#define EID_CONTENT_INSPECT_RESULT 0x00000023
94+
#define EID_SUPER_RESOLUTION_ENABLED 0x00000124
9495
typedef struct _StreamPublished {
9596
char* url;
9697
int error;

0 commit comments

Comments
 (0)