Skip to content

Commit 4c047a5

Browse files
committed
DEMO-3127
1 parent e569548 commit 4c047a5

8 files changed

Lines changed: 61 additions & 12 deletions

File tree

windows/APIExample/APIExample/APIExample.rc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -573,19 +573,21 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
573573
BEGIN
574574
LTEXT "",IDC_STATIC_VIDEO,1,0,483,310
575575
LISTBOX IDC_LIST_INFO_BROADCASTING,491,0,139,312,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
576-
COMBOBOX IDC_COMBO_ROLE,56,348,60,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
577-
COMBOBOX IDC_COMBO_PERSONS,182,348,60,30,CBS_DROPDOWNLIST | WS_VSCROLL
576+
COMBOBOX IDC_COMBO_ROLE,56,349,60,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
577+
COMBOBOX IDC_COMBO_PERSONS,168,349,60,30,CBS_DROPDOWNLIST | WS_VSCROLL
578578
LTEXT "Client Role",IDC_STATIC_ROLE,8,351,44,10
579-
LTEXT "Persons",IDC_STATIC_PERSONS,141,351,37,8
580-
LTEXT "Channel Name",IDC_STATIC_CHANNELNAME,259,350,48,8
581-
EDITTEXT IDC_EDIT_CHANNELNAME,319,348,218,13,ES_AUTOHSCROLL
582-
PUSHBUTTON "JoinChannel",IDC_BUTTON_JOINCHANNEL,555,348,50,14
583-
LTEXT "",IDC_STATIC_DETAIL,403,313,188,27
579+
LTEXT "Persons",IDC_STATIC_PERSONS,123,353,37,8
580+
LTEXT "Channel Name",IDC_STATIC_CHANNELNAME,240,353,48,8
581+
EDITTEXT IDC_EDIT_CHANNELNAME,296,349,108,12,ES_AUTOHSCROLL
582+
PUSHBUTTON "JoinChannel",IDC_BUTTON_JOINCHANNEL,412,347,50,14
583+
LTEXT "",IDC_STATIC_DETAIL,420,314,188,27
584584
LTEXT "Loopback Device",IDC_STATIC_LOOPBACK_DEVICE,12,373,66,8
585585
COMBOBOX IDC_COMBO_LOOPBACK_DEVICE,81,370,150,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
586586
CONTROL "Enable Loopback",IDC_CHECK_LOOPBACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,242,369,72,13
587587
LTEXT "Loopback Volume",IDC_STATIC_LOOPBACK_VOLUME,319,371,68,8
588588
CONTROL "",IDC_SLIDER_LOOPBACK,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,392,366,204,17
589+
COMBOBOX IDC_COMBO_AUDIENCE_LATENCY,548,349,60,30,CBS_DROPDOWNLIST | WS_VSCROLL
590+
LTEXT "Audience Latency",IDC_STATIC_AUDIENCE_LATENCY,476,350,62,8
589591
END
590592

591593
IDD_DIALOG_MUTI_SOURCE DIALOGEX 0, 0, 632, 400

windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.cpp

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ void CLiveBroadcastingDlg::DoDataExchange(CDataExchange* pDX)
112112
DDX_Control(pDX, IDC_COMBO_LOOPBACK_DEVICE, m_cmbLoopbackDevice);
113113
DDX_Control(pDX, IDC_STATIC_LOOPBACK_DEVICE, m_staLoopbackDevice);
114114
DDX_Control(pDX, IDC_STATIC_LOOPBACK_VOLUME, m_staLoopVolume);
115+
DDX_Control(pDX, IDC_STATIC_AUDIENCE_LATENCY, m_staAudienceLatency);
116+
DDX_Control(pDX, IDC_COMBO_AUDIENCE_LATENCY, m_cmbLatency);
115117
}
116118

117119

@@ -128,6 +130,7 @@ BEGIN_MESSAGE_MAP(CLiveBroadcastingDlg, CDialogEx)
128130
ON_STN_CLICKED(IDC_STATIC_VIDEO, &CLiveBroadcastingDlg::OnStnClickedStaticVideo)
129131
ON_WM_HSCROLL()
130132
ON_BN_CLICKED(IDC_CHECK_LOOPBACK, &CLiveBroadcastingDlg::OnClickedCheckLoopback)
133+
ON_CBN_SELCHANGE(IDC_COMBO_AUDIENCE_LATENCY, &CLiveBroadcastingDlg::OnSelchangeComboAudienceLatency)
131134
END_MESSAGE_MAP()
132135

133136

@@ -146,13 +149,19 @@ BOOL CLiveBroadcastingDlg::OnInitDialog()
146149
m_cmbPersons.InsertString(i++, _T("1V3"));
147150
m_cmbPersons.InsertString(i++, _T("1V8"));
148151
m_cmbPersons.InsertString(i++, _T("1V15"));
152+
153+
i = 0;
154+
m_cmbLatency.InsertString(i++, liveCtrlAudienceLowLatency);
155+
m_cmbLatency.InsertString(i++, liveCtrlAudienceUltraLowLatency);
156+
149157
ResumeStatus();
150158
m_sldVolume.SetRange(0, 100);
151159
m_sldVolume.EnableWindow(FALSE);
152160

153161
m_staLoopbackDevice.SetWindowText(liveCtrlLoopbackDevice);
154162
m_staLoopVolume.SetWindowText(liveCtrlLoopbackVolume);
155163
m_chkEnable.SetWindowText(liveCtrlLoopbackEnable);
164+
m_cmbLatency.EnableWindow(FALSE);
156165
return TRUE;
157166
}
158167

@@ -164,6 +173,7 @@ void CLiveBroadcastingDlg::InitCtrlText()
164173
m_staPersons.SetWindowText(liveCtrlPersons);
165174
m_staChannelName.SetWindowText(commonCtrlChannel);
166175
m_btnJoinChannel.SetWindowText(commonCtrlJoinChannel);
176+
m_staAudienceLatency.SetWindowText(liveCtrlAudienceLatency);
167177
}
168178

169179
//create all video window to save m_videoWnds.
@@ -277,10 +287,9 @@ bool CLiveBroadcastingDlg::InitAgora()
277287
//set channel profile in the engine to the CHANNEL_PROFILE_LIVE_BROADCASTING.
278288
m_rtcEngine->setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING);
279289
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("live broadcasting"));
280-
ClientRoleOptions role_options;
281-
role_options.audienceLatencyLevel = AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY;
290+
282291
//set client role in the engine to the CLIENT_ROLE_BROADCASTER.
283-
m_rtcEngine->setClientRole(CLIENT_ROLE_BROADCASTER, role_options);
292+
m_rtcEngine->setClientRole(CLIENT_ROLE_BROADCASTER);
284293
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("setClientRole broadcaster"));
285294

286295
m_audioDeviceManager = new AAudioDeviceManager(m_rtcEngine);
@@ -324,6 +333,7 @@ void CLiveBroadcastingDlg::ResumeStatus()
324333
m_lstInfo.ResetContent();
325334
m_cmbRole.SetCurSel(0);
326335
m_cmbPersons.SetCurSel(0);
336+
m_cmbLatency.SetCurSel(0);
327337
ShowVideoWnds();
328338
InitCtrlText();
329339
m_btnJoinChannel.EnableWindow(TRUE);
@@ -362,6 +372,12 @@ void CLiveBroadcastingDlg::OnSelchangeComboPersons()
362372

363373
void CLiveBroadcastingDlg::OnSelchangeComboRole()
364374
{
375+
if (m_cmbRole.GetCurSel() == 0) {
376+
m_cmbLatency.EnableWindow(FALSE);
377+
}
378+
else {
379+
m_cmbLatency.EnableWindow(TRUE);
380+
}
365381
if (m_rtcEngine) {
366382
m_rtcEngine->setClientRole(CLIENT_ROLE_TYPE(m_cmbRole.GetCurSel() + 1));
367383

@@ -560,3 +576,13 @@ void CLiveBroadcastingDlg::OnClickedCheckLoopback()
560576
m_rtcEngine->enableLoopbackRecording(true, name);
561577
}
562578
}
579+
580+
581+
void CLiveBroadcastingDlg::OnSelchangeComboAudienceLatency()
582+
{
583+
ClientRoleOptions role_options;
584+
role_options.audienceLatencyLevel = (AUDIENCE_LATENCY_LEVEL_TYPE)(m_cmbLatency.GetCurSel() + 1);
585+
586+
//set client role in the engine to the CLIENT_ROLE_BROADCASTER.
587+
m_rtcEngine->setClientRole((CLIENT_ROLE_TYPE)(m_cmbRole.GetCurSel()+1), role_options);
588+
}

windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,7 @@ class CLiveBroadcastingDlg : public CDialogEx
155155
CComboBox m_cmbLoopbackDevice;
156156
CStatic m_staLoopbackDevice;
157157
CStatic m_staLoopVolume;
158+
CStatic m_staAudienceLatency;
159+
CComboBox m_cmbLatency;
160+
afx_msg void OnSelchangeComboAudienceLatency();
158161
};

windows/APIExample/APIExample/Language.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ extern wchar_t liveCtrlPersons[INFO_LEN];
5252
extern wchar_t liveCtrlLoopbackDevice[INFO_LEN];
5353
extern wchar_t liveCtrlLoopbackVolume[INFO_LEN];
5454
extern wchar_t liveCtrlLoopbackEnable[INFO_LEN];
55+
extern wchar_t liveCtrlAudienceLatency[INFO_LEN];
56+
extern wchar_t liveCtrlAudienceLowLatency[INFO_LEN];
57+
extern wchar_t liveCtrlAudienceUltraLowLatency[INFO_LEN];
5558
//rtmp streaming
5659
extern wchar_t rtmpStreamingCtrlPublishUrl[INFO_LEN];
5760
extern wchar_t rtmpStreamingCtrlAdd[INFO_LEN];

windows/APIExample/APIExample/en.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ Basic.LiveBroadcasting=LiveBroadcasting
1919
Basic.Loopback.Device=loopback Device
2020
Basic.Loopback.Volume=loopback Volume
2121
Basic.Loopback.Enable=Enable loopback
22-
22+
Basic.Audience.Latency=Audience Latency
23+
Basic.Audience.Latency.UltraLow=Ultra Low latency
24+
Basic.Audience.Latency.Low=Low latency
2325
Advanced.RtmpStreaming=Rtmp Streaming
2426
Advanced.RtmpInject=Rtmp Inject
2527
Advanced.Metadata=Video SEI

windows/APIExample/APIExample/resource.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@
6666
#define IDC_EDIT_ENCRYPT_KEY 1022
6767
#define IDC_BUTTON_LEAVE_CHANNEL 1022
6868
#define IDC_BUTTON_PUBLISH 1022
69+
#define IDC_COMBO_PERSONS2 1022
70+
#define IDC_COMBO_AUDIENCE_LATENCY 1022
6971
#define IDC_EDIT_SEI 1023
7072
#define IDC_EDIT_BEAUTY_REDNESS 1023
7173
#define IDC_EDIT_AUDIO_REPEAT_TIMES 1023
7274
#define IDC_EDIT_FPS 1023
7375
#define IDC_EDIT_VIDEO_SOURCE 1023
7476
#define IDC_EDIT_VIDEO_HEIGHT 1023
77+
#define IDC_STATIC_AUDIENCE_LATENCY 1023
7578
#define IDC_BUTTON_ADDSTREAM 1024
7679
#define IDC_BUTTON_SEND 1024
7780
#define IDC_EDIT_BEAUTY_SMOOTHNESS 1024

windows/APIExample/APIExample/stdafx.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ wchar_t mediaIOScreenMotion[INFO_LEN] = { 0 };
276276
wchar_t mediaIOScreenDetails[INFO_LEN] = { 0 };
277277
wchar_t mediaIOScreenNone[INFO_LEN] = { 0 };
278278

279+
wchar_t liveCtrlAudienceLatency[INFO_LEN] = { 0 };
280+
wchar_t liveCtrlAudienceLowLatency[INFO_LEN] = { 0 };
281+
wchar_t liveCtrlAudienceUltraLowLatency[INFO_LEN] = { 0 };
282+
279283
std::string cs2utf8(CString str)
280284
{
281285
char szBuf[2 * MAX_PATH] = { 0 };
@@ -351,6 +355,10 @@ void InitKeyInfomation()
351355
_tcscpy_s(liveCtrlLoopbackVolume, INFO_LEN, Str(_T("Basic.Loopback.Volume")));
352356
_tcscpy_s(liveCtrlLoopbackEnable, INFO_LEN, Str(_T("Basic.Loopback.Enable")));
353357

358+
_tcscpy_s(liveCtrlAudienceLatency, INFO_LEN, Str(_T("Basic.Audience.Latency")));
359+
_tcscpy_s(liveCtrlAudienceLowLatency, INFO_LEN, Str(_T("Basic.Audience.Latency.Low")));
360+
_tcscpy_s(liveCtrlAudienceUltraLowLatency, INFO_LEN, Str(_T("Basic.Audience.Latency.UltraLow")));
361+
354362
//advanced scene list
355363
_tcscpy_s(advancedRtmpStreaming, INFO_LEN, Str(_T("Advanced.RtmpStreaming")));
356364
_tcscpy_s(advancedVideoMetadata, INFO_LEN, Str(_T("Advanced.Metadata")));

windows/APIExample/APIExample/zh-cn.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ Common.Ctrl.LeaveChannel=
4747
Common.Ctrl.ClientRole=角色
4848

4949
LiveBroadcasting.Ctrl.Persons=人数
50-
50+
Basic.Audience.Latency=观众延迟
51+
Basic.Audience.Latency.UltraLow=超低延迟
52+
Basic.Audience.Latency.Low=低延迟
5153

5254
RtmpStreaming.Ctrl.TransCoding=转码
5355
RtmpInject.Ctrl.Url=插入流地址

0 commit comments

Comments
 (0)