Skip to content

Commit

Permalink
Merge pull request #426 from AgoraIO/dev/4.5.0-windows
Browse files Browse the repository at this point in the history
fix bug for 4.5.0 (windows)
  • Loading branch information
tamworth authored Oct 24, 2024
2 parents 459f489 + 0b961f1 commit a87591b
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 53 deletions.
3 changes: 2 additions & 1 deletion windows/APIExample/APIExample/APIExample.rc
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ BEGIN
COMBOBOX IDC_COMBO_AUDIO_SCENARIO,84,372,218,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Dest Channel Name",IDC_STATIC_Dest_Channel_Name,8,329,64,8
EDITTEXT IDC_EDIT_DEST_CHANNEL_NAME,84,327,218,14,ES_AUTOHSCROLL
CONTROL "Forward Audio Stream",IDC_CHECK_SECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,330,79,10
CONTROL "Forward Audio Stream",IDC_CHECK_SECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,330,94,10
END

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

IDD_DIALOG_MULTI_VIDEO_SOURCE_TRACKS DIALOGEX 0, 0, 632, 400
Expand Down
12 changes: 9 additions & 3 deletions windows/APIExample/APIExample/APIExample.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ if exist en.ini (copy en.ini $(SolutionDir)$(Configuration))
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(SolutionDir)$(Configuration)
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Configuration)
if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Configuration))
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>
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))
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))
</Command>
</PostBuildEvent>
<Manifest>
<AdditionalManifestFiles>
Expand Down Expand Up @@ -169,6 +171,7 @@ copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(Solutio
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Platform)\$(Configuration)
if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)$(Configuration))
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))
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))
</Command>
</PostBuildEvent>
<Manifest>
Expand Down Expand Up @@ -215,7 +218,8 @@ copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(Solutio
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Configuration)

if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Configuration))
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>
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))
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))</Command>
</PostBuildEvent>
<ManifestResourceCompile>
<ResourceOutputFileName>
Expand Down Expand Up @@ -263,7 +267,8 @@ if exist en.ini (copy en.ini $(SolutionDir)$(Platform)\$(Configuration))
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Platform)\$(Configuration)

if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
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>
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))
if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration))</Command>
</PostBuildEvent>
<Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
Expand Down Expand Up @@ -408,6 +413,7 @@ if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (c
<CopyFileToFolders Include="sample.yuv">
<FileType>Document</FileType>
</CopyFileToFolders>
<None Include="res\hdr_1280_720.yuv" />
<None Include="res\wave2.bin" />
<None Include="zh-cn.ini" />
</ItemGroup>
Expand Down
7 changes: 4 additions & 3 deletions windows/APIExample/APIExample/APIExample.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,6 @@
</ClInclude>
<ClInclude Include="Basic\JoinChannelVideoByToken\CJoinChannelVideoByTokenDlg.h">
<Filter>Basic\JoinChannelVideoByToken</Filter>
</ClInclude>
<ClInclude Include="Advanced\CrossChannel\CAgoraCrossChannelDlg.h">
<Filter>Advanced\CrossChannel</Filter>
</ClInclude>
<ClInclude Include="Advanced\Metadata\CAgoraMetaDataDlg.h">
<Filter>Advanced\Metadata</Filter>
Expand Down Expand Up @@ -440,6 +437,9 @@
<ClCompile Include="Advanced\Beauty\CDlgBeautyEx.cpp">
<Filter>Advanced\Beauty</Filter>
</ClCompile>
<ClCompile Include="Advanced\CrossChannel\CAgoraCrossChannelDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="APIExample.rc">
Expand All @@ -459,6 +459,7 @@
<None Include="res\wave2.bin">
<Filter>Resource Files</Filter>
</None>
<None Include="res\hdr_1280_720.yuv" />
</ItemGroup>
<ItemGroup>
<Image Include="res\APIExample.ico">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,15 @@ void CAgoraAudioProfile::joinSecondChannelAndStartAudioMixer()
LocalAudioMixerConfiguration config;
config.syncWithLocalMic = false;
config.streamCount = 2;
config.sourceStreams = sourceStreams;
config.audioInputStreams = sourceStreams;

MixedAudioStream remoteStream( AUDIO_SOURCE_REMOTE_CHANNEL);
remoteStream.channelName = mainchannelName;
config.sourceStreams[0] = remoteStream;
remoteStream.channelId = mainchannelName;
config.audioInputStreams[0] = remoteStream;

MixedAudioStream remoteStream2(AUDIO_SOURCE_MICROPHONE);
remoteStream2.channelName = mainchannelName;
config.sourceStreams[1] = remoteStream2;
remoteStream2.channelId = mainchannelName;
config.audioInputStreams[1] = remoteStream2;
int ret = m_rtcEngine->startLocalAudioMixer(config);
if (ret != 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,31 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonAddCrossChannel()
AfxMessageBox(_T("The channel and user ID cannot be empty"));
return;
}
ChannelMediaInfo mediaInfo;

std::string szChannel = cs2utf8(strChannel);
std::string szToken = cs2utf8(strToken);
mediaInfo.channelName = new char[strChannel.GetLength() + 1];
mediaInfo.token = new char[strToken.GetLength() + 1];
mediaInfo.uid = _ttol(strUID);
strcpy_s(const_cast<char*>(mediaInfo.channelName), strChannel.GetLength() + 1, szChannel.data());
strcpy_s(const_cast<char*>(mediaInfo.token), strToken.GetLength() + 1, szToken.data());
//add mediaInfo to vector.
m_vecChannelMedias.push_back(mediaInfo);
m_cmbCrossChannelList.AddString(strChannel);
m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1);
auto it = std::find_if(m_vecChannelMedias.begin(), m_vecChannelMedias.end(),
[&](const ChannelMediaInfo& info) {
return info.channelName == szChannel && info.token == szToken;
});

if (it == m_vecChannelMedias.end()) {
ChannelMediaInfo mediaInfo;
mediaInfo.channelName = new char[strChannel.GetLength() + 1];
mediaInfo.token = new char[strToken.GetLength() + 1];
mediaInfo.uid = _ttol(strUID);
strcpy_s(const_cast<char*>(mediaInfo.channelName), strChannel.GetLength() + 1, szChannel.data());
strcpy_s(const_cast<char*>(mediaInfo.token), strToken.GetLength() + 1, szToken.data());
//add mediaInfo to vector.
m_vecChannelMedias.push_back(mediaInfo);
m_cmbCrossChannelList.AddString(strChannel);
m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1);
}
else
{
AfxMessageBox(_T("already added for same channel and token"));
}

}

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

int offset = 0;
//erase media info from m_vecChannelMedias
for (auto & mediaInfo : m_vecChannelMedias)
{
if (szChannelName.compare(mediaInfo.channelName) == 0)
{
delete mediaInfo.channelName;
delete mediaInfo.token;
m_vecChannelMedias.erase(m_vecChannelMedias.begin() + offset);
}
offset++;
auto it = std::find_if(m_vecChannelMedias.begin(), m_vecChannelMedias.end(),
[&szChannelName](const ChannelMediaInfo& info) {
return info.channelName == szChannelName;
});

if (it != m_vecChannelMedias.end()) {
delete it->channelName;
delete it->token;
m_vecChannelMedias.erase(it);
}
m_cmbCrossChannelList.DeleteString(nSel);
m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1);

}

//start media relay or stop media relay
Expand All @@ -315,6 +327,11 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonStartMediaRelay()
if (!m_startMediaRelay)
{
int nDestCount = m_vecChannelMedias.size();
if (nDestCount<=0)
{
AfxMessageBox(_T("please config target channel config first"));
return;
}
ChannelMediaInfo *lpDestInfos = new ChannelMediaInfo[nDestCount];
for (int nIndex = 0; nIndex < nDestCount; nIndex++) {
lpDestInfos[nIndex].channelName = m_vecChannelMedias[nIndex].channelName;
Expand Down
Loading

0 comments on commit a87591b

Please sign in to comment.