Skip to content

Commit 9efbabd

Browse files
authored
Merge pull request #426 from AgoraIO/dev/4.5.0-windows
fix bug for 4.5.0 (windows)
2 parents 0a5deb4 + a5e3e6e commit 9efbabd

10 files changed

Lines changed: 169 additions & 53 deletions

File tree

windows/APIExample/APIExample/APIExample.rc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ BEGIN
295295
COMBOBOX IDC_COMBO_AUDIO_SCENARIO,84,372,218,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
296296
LTEXT "Dest Channel Name",IDC_STATIC_Dest_Channel_Name,8,329,64,8
297297
EDITTEXT IDC_EDIT_DEST_CHANNEL_NAME,84,327,218,14,ES_AUTOHSCROLL
298-
CONTROL "Forward Audio Stream",IDC_CHECK_SECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,330,79,10
298+
CONTROL "Forward Audio Stream",IDC_CHECK_SECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,330,94,10
299299
END
300300

301301
IDD_DIALOG_AUDIO_MIX DIALOGEX 0, 0, 632, 400
@@ -714,6 +714,7 @@ BEGIN
714714
EDITTEXT IDC_EDIT_CHANNELNAME,71,326,218,13,ES_AUTOHSCROLL
715715
PUSHBUTTON "JoinChannel",IDC_BUTTON_JOINCHANNEL,307,326,50,14
716716
LTEXT "",IDC_STATIC_DETAIL,442,325,181,58
717+
CONTROL "HDR",IDC_CHECK_HDR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,390,327,30,10
717718
END
718719

719720
IDD_DIALOG_MULTI_VIDEO_SOURCE_TRACKS DIALOGEX 0, 0, 632, 400

windows/APIExample/APIExample/APIExample.vcxproj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ if exist en.ini (copy en.ini $(SolutionDir)$(Configuration))
122122
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(SolutionDir)$(Configuration)
123123
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Configuration)
124124
if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Configuration))
125-
if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration))</Command>
125+
if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration))
126+
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))
127+
</Command>
126128
</PostBuildEvent>
127129
<Manifest>
128130
<AdditionalManifestFiles>
@@ -169,6 +171,7 @@ copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(Solutio
169171
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Platform)\$(Configuration)
170172
if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)$(Configuration))
171173
if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration))
174+
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))
172175
</Command>
173176
</PostBuildEvent>
174177
<Manifest>
@@ -215,7 +218,8 @@ copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(Solutio
215218
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Configuration)
216219

217220
if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Configuration))
218-
if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration))</Command>
221+
if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration))
222+
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))</Command>
219223
</PostBuildEvent>
220224
<ManifestResourceCompile>
221225
<ResourceOutputFileName>
@@ -263,7 +267,8 @@ if exist en.ini (copy en.ini $(SolutionDir)$(Platform)\$(Configuration))
263267
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Platform)\$(Configuration)
264268

265269
if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
266-
if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration))</Command>
270+
if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration))
271+
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))</Command>
267272
</PostBuildEvent>
268273
<Manifest>
269274
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
@@ -408,6 +413,7 @@ if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (c
408413
<CopyFileToFolders Include="sample.yuv">
409414
<FileType>Document</FileType>
410415
</CopyFileToFolders>
416+
<None Include="res\hdr_1280_720.yuv" />
411417
<None Include="res\wave2.bin" />
412418
<None Include="zh-cn.ini" />
413419
</ItemGroup>

windows/APIExample/APIExample/APIExample.vcxproj.filters

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@
266266
</ClInclude>
267267
<ClInclude Include="Basic\JoinChannelVideoByToken\CJoinChannelVideoByTokenDlg.h">
268268
<Filter>Basic\JoinChannelVideoByToken</Filter>
269-
</ClInclude>
270-
<ClInclude Include="Advanced\CrossChannel\CAgoraCrossChannelDlg.h">
271-
<Filter>Advanced\CrossChannel</Filter>
272269
</ClInclude>
273270
<ClInclude Include="Advanced\Metadata\CAgoraMetaDataDlg.h">
274271
<Filter>Advanced\Metadata</Filter>
@@ -440,6 +437,9 @@
440437
<ClCompile Include="Advanced\Beauty\CDlgBeautyEx.cpp">
441438
<Filter>Advanced\Beauty</Filter>
442439
</ClCompile>
440+
<ClCompile Include="Advanced\CrossChannel\CAgoraCrossChannelDlg.cpp">
441+
<Filter>Source Files</Filter>
442+
</ClCompile>
443443
</ItemGroup>
444444
<ItemGroup>
445445
<ResourceCompile Include="APIExample.rc">
@@ -459,6 +459,7 @@
459459
<None Include="res\wave2.bin">
460460
<Filter>Resource Files</Filter>
461461
</None>
462+
<None Include="res\hdr_1280_720.yuv" />
462463
</ItemGroup>
463464
<ItemGroup>
464465
<Image Include="res\APIExample.ico">

windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,15 @@ void CAgoraAudioProfile::joinSecondChannelAndStartAudioMixer()
321321
LocalAudioMixerConfiguration config;
322322
config.syncWithLocalMic = false;
323323
config.streamCount = 2;
324-
config.sourceStreams = sourceStreams;
324+
config.audioInputStreams = sourceStreams;
325325

326326
MixedAudioStream remoteStream( AUDIO_SOURCE_REMOTE_CHANNEL);
327-
remoteStream.channelName = mainchannelName;
328-
config.sourceStreams[0] = remoteStream;
327+
remoteStream.channelId = mainchannelName;
328+
config.audioInputStreams[0] = remoteStream;
329329

330330
MixedAudioStream remoteStream2(AUDIO_SOURCE_MICROPHONE);
331-
remoteStream2.channelName = mainchannelName;
332-
config.sourceStreams[1] = remoteStream2;
331+
remoteStream2.channelId = mainchannelName;
332+
config.audioInputStreams[1] = remoteStream2;
333333
int ret = m_rtcEngine->startLocalAudioMixer(config);
334334
if (ret != 0)
335335
{

windows/APIExample/APIExample/Advanced/CrossChannel/CAgoraCrossChannelDlg.cpp

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,31 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonAddCrossChannel()
270270
AfxMessageBox(_T("The channel and user ID cannot be empty"));
271271
return;
272272
}
273-
ChannelMediaInfo mediaInfo;
273+
274274
std::string szChannel = cs2utf8(strChannel);
275275
std::string szToken = cs2utf8(strToken);
276-
mediaInfo.channelName = new char[strChannel.GetLength() + 1];
277-
mediaInfo.token = new char[strToken.GetLength() + 1];
278-
mediaInfo.uid = _ttol(strUID);
279-
strcpy_s(const_cast<char*>(mediaInfo.channelName), strChannel.GetLength() + 1, szChannel.data());
280-
strcpy_s(const_cast<char*>(mediaInfo.token), strToken.GetLength() + 1, szToken.data());
281-
//add mediaInfo to vector.
282-
m_vecChannelMedias.push_back(mediaInfo);
283-
m_cmbCrossChannelList.AddString(strChannel);
284-
m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1);
276+
auto it = std::find_if(m_vecChannelMedias.begin(), m_vecChannelMedias.end(),
277+
[&](const ChannelMediaInfo& info) {
278+
return info.channelName == szChannel && info.token == szToken;
279+
});
280+
281+
if (it == m_vecChannelMedias.end()) {
282+
ChannelMediaInfo mediaInfo;
283+
mediaInfo.channelName = new char[strChannel.GetLength() + 1];
284+
mediaInfo.token = new char[strToken.GetLength() + 1];
285+
mediaInfo.uid = _ttol(strUID);
286+
strcpy_s(const_cast<char*>(mediaInfo.channelName), strChannel.GetLength() + 1, szChannel.data());
287+
strcpy_s(const_cast<char*>(mediaInfo.token), strToken.GetLength() + 1, szToken.data());
288+
//add mediaInfo to vector.
289+
m_vecChannelMedias.push_back(mediaInfo);
290+
m_cmbCrossChannelList.AddString(strChannel);
291+
m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1);
292+
}
293+
else
294+
{
295+
AfxMessageBox(_T("already added for same channel and token"));
296+
}
297+
285298
}
286299

287300
//remove combobox item
@@ -293,20 +306,19 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonRemoveCrossChannel2()
293306
m_cmbCrossChannelList.GetWindowText(strChannelName);
294307
std::string szChannelName = cs2utf8(strChannelName);
295308

296-
int offset = 0;
297-
//erase media info from m_vecChannelMedias
298-
for (auto & mediaInfo : m_vecChannelMedias)
299-
{
300-
if (szChannelName.compare(mediaInfo.channelName) == 0)
301-
{
302-
delete mediaInfo.channelName;
303-
delete mediaInfo.token;
304-
m_vecChannelMedias.erase(m_vecChannelMedias.begin() + offset);
305-
}
306-
offset++;
309+
auto it = std::find_if(m_vecChannelMedias.begin(), m_vecChannelMedias.end(),
310+
[&szChannelName](const ChannelMediaInfo& info) {
311+
return info.channelName == szChannelName;
312+
});
313+
314+
if (it != m_vecChannelMedias.end()) {
315+
delete it->channelName;
316+
delete it->token;
317+
m_vecChannelMedias.erase(it);
307318
}
308319
m_cmbCrossChannelList.DeleteString(nSel);
309320
m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1);
321+
310322
}
311323

312324
//start media relay or stop media relay
@@ -315,6 +327,11 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonStartMediaRelay()
315327
if (!m_startMediaRelay)
316328
{
317329
int nDestCount = m_vecChannelMedias.size();
330+
if (nDestCount<=0)
331+
{
332+
AfxMessageBox(_T("please config target channel config first"));
333+
return;
334+
}
318335
ChannelMediaInfo *lpDestInfos = new ChannelMediaInfo[nDestCount];
319336
for (int nIndex = 0; nIndex < nDestCount; nIndex++) {
320337
lpDestInfos[nIndex].channelName = m_vecChannelMedias[nIndex].channelName;

0 commit comments

Comments
 (0)