Skip to content
Open
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
aff7f49
fixes
ispysoftware Mar 30, 2020
6cd2dc7
add ice candidate
ispysoftware Apr 1, 2020
7928b15
fix
ispysoftware Apr 1, 2020
2172dfa
updates
ispysoftware Apr 1, 2020
8a09967
Add resolve method to ice candidate
ispysoftware Apr 1, 2020
3e3ea15
fixes
ispysoftware Apr 1, 2020
7db767e
try again
ispysoftware Apr 1, 2020
91079d5
try2
ispysoftware Apr 1, 2020
d63efc3
try 3
ispysoftware Apr 1, 2020
ae621a0
m
ispysoftware Apr 1, 2020
226b6dc
xcv
ispysoftware Apr 1, 2020
f9f2217
a
ispysoftware Apr 1, 2020
1c644ab
a
ispysoftware Apr 1, 2020
00e174a
a
ispysoftware Apr 1, 2020
809ec51
h
ispysoftware Apr 1, 2020
95aff5b
datachannel stuff
ispysoftware Apr 2, 2020
5a6e66e
a
ispysoftware Apr 2, 2020
096ffcd
cap W
ispysoftware Apr 2, 2020
d25f927
add status
ispysoftware Apr 2, 2020
29bd31c
a
ispysoftware Apr 2, 2020
1457a89
a
ispysoftware Apr 2, 2020
52342cc
a
ispysoftware Apr 2, 2020
14ea6d2
b
ispysoftware Apr 2, 2020
898f36c
send data
ispysoftware Apr 2, 2020
3091c06
send updates
ispysoftware Apr 2, 2020
79cce04
a
ispysoftware Apr 2, 2020
bd345de
c
ispysoftware Apr 2, 2020
b9dfc75
d
ispysoftware Apr 2, 2020
8fc55d0
d
ispysoftware Apr 2, 2020
1001d33
g
ispysoftware Apr 2, 2020
5eafce2
h
ispysoftware Apr 2, 2020
2141efb
j
ispysoftware Apr 2, 2020
72bab18
k
ispysoftware Apr 2, 2020
5cb04b3
l
ispysoftware Apr 2, 2020
7cf67e4
m
ispysoftware Apr 2, 2020
f926444
add callback code
ispysoftware Apr 3, 2020
a4b68f4
fix
ispysoftware Apr 3, 2020
d3e504f
fix 2
ispysoftware Apr 3, 2020
8da0703
fix3
ispysoftware Apr 3, 2020
2cc718f
fixes
ispysoftware Apr 3, 2020
3ad8f82
return state enum
ispysoftware Apr 3, 2020
164d806
update status for enum
ispysoftware Apr 3, 2020
b1d89c9
test
ispysoftware Apr 3, 2020
dad791b
try fix audio
ispysoftware Apr 4, 2020
4904566
sdf
ispysoftware Apr 4, 2020
612e061
code cleanup
ispysoftware Apr 4, 2020
6294d57
release datachannel
ispysoftware Apr 5, 2020
4121d65
add cs call
ispysoftware Apr 5, 2020
081025d
move header call
ispysoftware Apr 5, 2020
4da9eaf
fixes
ispysoftware Apr 5, 2020
783973b
fixes
ispysoftware Apr 5, 2020
46ed2ee
remove delete
ispysoftware Apr 5, 2020
c5ba7f0
fix callback name
ispysoftware Apr 5, 2020
2ebc766
fix naming
ispysoftware Apr 5, 2020
2b63289
Add linux build
ispysoftware Apr 5, 2020
7333aad
target x86
ispysoftware Apr 5, 2020
17f38b4
remove linux x86
ispysoftware Apr 5, 2020
6868ec8
x86 win build update
ispysoftware Apr 5, 2020
bcc6712
remove x86 license generation
ispysoftware Apr 5, 2020
a740903
add license
ispysoftware Apr 5, 2020
a7a234a
add dummy audio devices
ispysoftware Apr 7, 2020
b4ae6d7
add to other builds
ispysoftware Apr 7, 2020
190bd47
fix marshalling
ispysoftware May 1, 2020
c4d5608
updates
ispysoftware Jul 8, 2020
b534d6f
update error handler
ispysoftware Jul 8, 2020
c7a449a
add build platforms
ispysoftware Jul 8, 2020
4dba880
remove x86
ispysoftware Jul 8, 2020
4c60739
remove winx64
ispysoftware Jul 8, 2020
baef370
remove ;
ispysoftware Jul 10, 2020
ac923d2
add winx64
ispysoftware Jul 10, 2020
17b9bd4
Revert "update error handler"
ispysoftware Jul 10, 2020
4255836
add turn server
ispysoftware Jul 10, 2020
6be9603
fark
ispysoftware Jul 10, 2020
b6e46dd
add turn server
ispysoftware Jul 14, 2020
cb34f26
remove debug info
ispysoftware Jul 16, 2020
9c3dbcb
updates to managed code
ispysoftware Sep 3, 2020
7f9cb99
fixes for msbuild
ispysoftware Sep 3, 2020
437a40d
various updates
ispysoftware Sep 6, 2020
bfff25e
updates
ispysoftware Sep 6, 2020
e663995
add flags for h264 compilation
ispysoftware Sep 7, 2020
76ed06e
updates
ispysoftware Feb 22, 2021
15179cd
remove webrtc proj build
ispysoftware Feb 22, 2021
ba03c79
remove tabs
ispysoftware Feb 22, 2021
fd161e7
update sources
ispysoftware Feb 24, 2023
65e1c57
bug fixes, playback timing update
ispysoftware Jul 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 86 additions & 1 deletion sdk/c/api/data_channel_interface.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,98 @@
/*
* Copyright 2019 pixiv Inc. All Rights Reserved.
* Copyright 2019 developerinabox. All Rights Reserved.
*
* Use of this source code is governed by a license that can be
* found in the LICENSE.pixiv file in the root of the source tree.
*/

#include "sdk/c/api/data_channel_interface.h"

namespace webrtc {

class DelegatingDataChannelObserver
: public DataChannelObserver {
public:
DelegatingDataChannelObserver(
void* context,
const struct WebrtcDataChannelObserverFunctions* functions) {
context_ = context;
functions_ = functions;
}

~DelegatingDataChannelObserver() {
functions_->on_destruction(context_);
}

void OnStateChange() override {
functions_->on_state_change(context_);
}

void OnMessage(const DataBuffer& buffer) override {
auto * data = buffer.data.data();
functions_->on_message(context_, buffer.binary, data, buffer.size());
}

void OnBufferedAmountChange(uint64_t sent_data_size) override {
functions_->on_buffered_amount_change(context_, sent_data_size);
}

private:
void* context_;
const struct WebrtcDataChannelObserverFunctions* functions_;
};
}

RTC_EXPORT extern "C" void webrtcDataChannelInterfaceRelease(
const WebrtcDataChannelInterface* channel) {
rtc::ToCplusplus(channel)->Release();
}

RTC_EXPORT extern "C" RtcString* webrtcDataChannelLabel(
const WebrtcDataChannelInterface* channel) {
return rtc::ToC(new auto(rtc::ToCplusplus(channel)->label()));
}

RTC_EXPORT extern "C" int webrtcDataChannelStatus(
const WebrtcDataChannelInterface* channel) {
auto chan = rtc::ToCplusplus(channel);
return chan->state();
}

RTC_EXPORT extern "C" bool webrtcDataChannelSendText(
WebrtcDataChannelInterface* channel,
const char* text
) {
auto chan = rtc::ToCplusplus(channel);
const auto db = webrtc::DataBuffer(text);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not short-circuit webrtc::DataBuffer and webrtc::DataChannelInterface::Send. The strict one-to-one rule of these bindings allow to reuse them for different purposes. For example, the bindings would not serve for your purpose if they were designed to have convenient interfaces for the example Unity project we made. We need you to follow the rule even if it is so troublesome.

return chan->Send(db);
}

RTC_EXPORT extern "C" bool webrtcDataChannelSendData(
WebrtcDataChannelInterface* channel,
const char* data,
size_t len
) {
auto chan = rtc::ToCplusplus(channel);
rtc::CopyOnWriteBuffer writeBuffer(data, len);
const auto db = webrtc::DataBuffer(writeBuffer, true);
return chan->Send(db);
}

RTC_EXPORT extern "C" WebrtcDataChannelObserver* webrtcDataChannelRegisterObserver(
void* context,
WebrtcDataChannelInterface* channel,
const struct WebrtcDataChannelObserverFunctions* functions) {

auto chan = rtc::ToCplusplus(channel);
auto obs = new webrtc::DelegatingDataChannelObserver(context, functions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. It should have a dedicated function, something like webrtcCreateDataChannelObserver.

chan->RegisterObserver(obs);
auto o = rtc::ToC(obs);
return o;
}

RTC_EXPORT extern "C" void webrtcDataChannelUnregisterObserver(
WebrtcDataChannelInterface* channel
) {
auto chan = rtc::ToCplusplus(channel);
chan->UnregisterObserver();
}
35 changes: 33 additions & 2 deletions sdk/c/api/data_channel_interface.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 pixiv Inc. All Rights Reserved.
* Copyright 2020 developerinabox. All Rights Reserved.
*
* Use of this source code is governed by a license that can be
* found in the LICENSE.pixiv file in the root of the source tree.
Expand All @@ -15,12 +15,43 @@

extern "C" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extern "C" {
extern "C" {
#else
#include <stdbool.h>
#include <stdint.h>

#endif

RTC_C_CLASS(webrtc::DataChannelInterface, WebrtcDataChannelInterface)
RTC_C_CLASS(webrtc::DataChannelObserver, WebrtcDataChannelObserver)

struct WebrtcDataChannelObserverFunctions {
void (*on_destruction)(void*);
void (*on_state_change)(void*);
void (*on_message)(void*, bool binary, const uint8_t* data, size_t len);
void (*on_buffered_amount_change)(void*, uint64_t);
};

RTC_EXPORT void webrtcDataChannelInterfaceRelease(
const WebrtcDataChannelInterface* channel);

RTC_EXPORT RtcString* webrtcDataChannelLabel(
const WebrtcDataChannelInterface* channel);

RTC_EXPORT int webrtcDataChannelStatus(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RTC_EXPORT int webrtcDataChannelStatus(
RTC_EXPORT int webrtcDataChannelState(

Follow the naming of the underlying function. It is crucial to make it easy to understand what feature it represents, especially because we do not provide additional documentations for the binding and users have to rely on the counterparts of the C++ APIs.

If you think such renaming is strongly preferred, it should be submitted to the upstream and reviewed by its maintainers.

const WebrtcDataChannelInterface* channel);

RTC_EXPORT bool webrtcDataChannelSendText(
WebrtcDataChannelInterface* channel,
const char* text);

RTC_EXPORT bool webrtcDataChannelSendData(
WebrtcDataChannelInterface* channel,
const char* data,
size_t len);

RTC_EXPORT WebrtcDataChannelObserver* webrtcDataChannelRegisterObserver(
void* context,
WebrtcDataChannelInterface* channel,
const struct WebrtcDataChannelObserverFunctions* functions);

RTC_EXPORT void webrtcDataChannelUnregisterObserver(
WebrtcDataChannelInterface* channel);


#ifdef __cplusplus
}
#endif
Expand Down
25 changes: 17 additions & 8 deletions sdk/c/api/jsep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,25 @@ extern "C" void webrtcDeleteSessionDescriptionInterface(
delete rtc::ToCplusplus(desc);
}

extern "C" bool webrtcIceCandidateInterfaceToString(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave webrtcIceCandidateInterfaceToString as is.

extern "C" bool webrtcIceCandidateInterfaceResolve(
const WebrtcIceCandidateInterface* candidate,
RtcString** out) {
if (!out) {
return false;
}

RtcString** sdpMid,
int* sdpMLineIndex,
RtcString** sdp
) {

auto c = rtc::ToCplusplus(candidate);

auto i = c->sdp_mline_index();
sdpMLineIndex = &i;

auto g = new std::string();
*sdpMid = rtc::ToC(g);
g->assign(c->sdp_mid());

auto s = new std::string();
*out = rtc::ToC(s);
return rtc::ToCplusplus(candidate)->ToString(s);
*sdp = rtc::ToC(s);
return c->ToString(s);
}

extern "C" WebrtcCreateSessionDescriptionObserver*
Expand Down
6 changes: 4 additions & 2 deletions sdk/c/api/jsep.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ RTC_EXPORT void webrtcCreateSessionDescriptionObserverRelease(
RTC_EXPORT void webrtcDeleteSessionDescriptionInterface(
WebrtcSessionDescriptionInterface* desc);

RTC_EXPORT bool webrtcIceCandidateInterfaceToString(
RTC_EXPORT bool webrtcIceCandidateInterfaceResolve(
const WebrtcIceCandidateInterface* candidate,
RtcString** out);
RtcString** sdpMid,
int* sdpMLineIndex,
RtcString** sdp);

RTC_EXPORT WebrtcCreateSessionDescriptionObserver*
webrtcNewCreateSessionDescriptionObserver(
Expand Down
12 changes: 12 additions & 0 deletions sdk/c/api/peer_connection_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,18 @@ webrtcPeerConnectionInterfaceAddTrack(WebrtcPeerConnectionInterface* connection,
return cresult;
}

RTC_EXPORT extern "C" bool
webrtcPeerConnectionInterfaceAddICECandidate(WebrtcPeerConnectionInterface* connection,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem to have a corresponding definition in the header file.

const char* sdpMid,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const char* sdpMid,
const char* sdp_mid,

Follow the style of C++ codes included in the upstream.

size_t sdpMLineIndex,
const char* sdp) {
webrtc::SdpParseError error;
webrtc::IceCandidateInterface * candidate = webrtc::CreateIceCandidate(sdpMid, sdpMLineIndex, sdp, &error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webrtc::CreateIceCandidate should have a dedicated C function.


return rtc::ToCplusplus(connection)
->AddIceCandidate(candidate);
}

RTC_EXPORT extern "C" void webrtcPeerConnectionInterfaceClose(
WebrtcPeerConnectionInterface* connection) {
rtc::ToCplusplus(connection)->Close();
Expand Down
3 changes: 0 additions & 3 deletions sdk/c_headers_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
* found in the LICENSE.pixiv file in the root of the source tree.
*/

#include "sdk/c/api/task_queue/queued_task.h"
#include "sdk/c/api/task_queue/task_queue_base.h"
#include "sdk/c/api/task_queue/task_queue_factory.h"
#include "sdk/c/api/video/video_buffer.h"
#include "sdk/c/api/video/video_frame.h"
#include "sdk/c/api/video/video_rotation.h"
Expand Down
19 changes: 13 additions & 6 deletions sdk/dotnet/unity/unity.msbuildproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Project>
<PropertyGroup>
<BaseOutputPath>bin/</BaseOutputPath>
<Configuration>Debug</Configuration>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not do that. Instead, you should pass /p:Configuration=Release when you invoke MSBuild.

<Configuration>Release</Configuration>
<OutputPath>$(BaseOutputPath)$(Configuration)/</OutputPath>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)/Microsoft.Common.targets" />
Expand All @@ -19,7 +19,7 @@
<FullOutputPath>$([System.IO.Path]::GetFullPath('$(OutputPath)'))</FullOutputPath>
<IsDebug Condition="'$(Configuration)' == Debug">true</IsDebug>
<IsDebug Condition="'$(Configuration)' != Debug">false</IsDebug>
<Targets>Android;Ios;LinuxX64;MacX64;WinX64</Targets>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also should not happen.

<Targets>LinuxX64</Targets>
<ParsibleTargets>;$(Targets);</ParsibleTargets>
<EscapedFullIntermediateOutputPath>"$(FullIntermediateOutputPath.Replace('\', '\\').Replace('"', '\"'))"</EscapedFullIntermediateOutputPath>
<EscapedFullOutputPath>$(FullOutputPath.Replace('\', '\\').Replace('"', '\"'))</EscapedFullOutputPath>
Expand All @@ -28,7 +28,7 @@
<EscapedOutputPath>"$(OutputPath.Replace('\', '\\').Replace('"', '\"'))"</EscapedOutputPath>
<EscapedTargets>"$(Targets.Replace('\', '\\').Replace('"', '\"'))"</EscapedTargets>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="BuildAndroid;BuildIos;BuildLinuxX64;BuildMacX64;BuildWinX64">
<Target Name="Build" DependsOnTargets="BuildAndroid;BuildIos;BuildLinuxX64;BuildMacX64;BuildWinX64;BuildWinX86">
<Exec Command="../../../tools_webrtc/unity/generate_licenses.py $(EscapedIntermediateOutputPath) $(EscapedOutputPath) $(EscapedTargets.Replace(';', '&quot; &quot;'))" />
<Copy
DestinationFolder="$(OutputPath)"
Expand Down Expand Up @@ -67,26 +67,33 @@
</Target>
<Target Condition="$(ParsibleTargets.Contains(';LinuxX64;'))" Name="BuildLinuxX64" DependsOnTargets="BuildExternal">
<Exec
Command="gn gen &quot;--args=is_debug=$(IsDebug) rtc_enable_symbol_export=true target_os=\&quot;linux\&quot; target_cpu=\&quot;x64\&quot;&quot; --root=$(EscapedMSBuildThisFileDirectory)../../.. $(EscapedIntermediateOutputPath)linux_x64"
Command="gn gen &quot;--args=is_debug=$(IsDebug) rtc_use_dummy_audio_file_devices=true rtc_enable_symbol_export=true target_os=\&quot;linux\&quot; target_cpu=\&quot;x64\&quot;&quot; --root=$(EscapedMSBuildThisFileDirectory)../../.. $(EscapedIntermediateOutputPath)linux_x64"
Condition="!Exists('$(IntermediateOutputPath)linux_x64/build.ninja')" />
<Exec Command="ninja -C $(EscapedIntermediateOutputPath)linux_x64 :jingle_peerconnection_so" />
<Copy DestinationFolder="$(OutputPath)Runtime" SourceFiles="$(IntermediateOutputPath)linux_x64/libjingle_peerconnection_so.so;$(MSBuildThisFileDirectory)Runtime/libjingle_peerconnection_so.so.meta" />
</Target>
<Target Condition="$(ParsibleTargets.Contains(';MacX64;'))" Name="BuildMacX64" DependsOnTargets="BuildExternal">
<Exec
Command="gn gen &quot;--args=is_debug=$(IsDebug) rtc_enable_symbol_export=true target_os=\&quot;mac\&quot; target_cpu=\&quot;x64\&quot;&quot; --root=$(EscapedMSBuildThisFileDirectory)../../.. $(EscapedIntermediateOutputPath)mac_x64"
Command="gn gen &quot;--args=is_debug=$(IsDebug) rtc_use_dummy_audio_file_devices=true rtc_enable_symbol_export=true target_os=\&quot;mac\&quot; target_cpu=\&quot;x64\&quot;&quot; --root=$(EscapedMSBuildThisFileDirectory)../../.. $(EscapedIntermediateOutputPath)mac_x64"
Condition="!Exists('$(IntermediateOutputPath)mac_x64/build.ninja')" />
<Exec Command="ninja -C $(EscapedIntermediateOutputPath)mac_x64 :jingle_peerconnection_so" />
<Copy DestinationFiles="$(OutputPath)Runtime/jingle_peerconnection_so.dylib" SourceFiles="$(IntermediateOutputPath)mac_x64/libjingle_peerconnection_so.dylib" />
<Copy DestinationFolder="$(OutputPath)Runtime" SourceFiles="$(MSBuildThisFileDirectory)Runtime/jingle_peerconnection_so.dylib.meta" />
</Target>
<Target Condition="$(ParsibleTargets.Contains(';WinX64;'))" Name="BuildWinX64" DependsOnTargets="BuildExternal">
<Exec
Command="gn gen &quot;--args=is_debug=$(IsDebug) rtc_enable_symbol_export=true target_os=\&quot;win\&quot; target_cpu=\&quot;x64\&quot;&quot; --root=$(EscapedMSBuildThisFileDirectory)../../.. $(EscapedIntermediateOutputPath)win_x64"
Command="gn gen &quot;--args=is_debug=$(IsDebug) rtc_use_dummy_audio_file_devices=true rtc_enable_symbol_export=true target_os=\&quot;win\&quot; target_cpu=\&quot;x64\&quot;&quot; --root=$(EscapedMSBuildThisFileDirectory)../../.. $(EscapedIntermediateOutputPath)win_x64"
Condition="!Exists('$(IntermediateOutputPath)win_x64/build.ninja')" />
<Exec Command="ninja -C $(EscapedIntermediateOutputPath)win_x64 :jingle_peerconnection_so" />
<Copy DestinationFolder="$(OutputPath)Runtime" SourceFiles="$(IntermediateOutputPath)win_x64/jingle_peerconnection_so.dll;$(MSBuildThisFileDirectory)Runtime/jingle_peerconnection_so.dll.meta" />
</Target>
<Target Condition="$(ParsibleTargets.Contains(';WinX86;'))" Name="BuildWinX86" DependsOnTargets="BuildExternal">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add this. Unity does not support x86.

<Exec
Command="gn gen &quot;--args=is_debug=$(IsDebug) rtc_use_dummy_audio_file_devices=true rtc_enable_symbol_export=true target_os=\&quot;win\&quot; target_cpu=\&quot;x86\&quot;&quot; --root=$(EscapedMSBuildThisFileDirectory)../../.. $(EscapedIntermediateOutputPath)win_x86"
Condition="!Exists('$(IntermediateOutputPath)win_x86/build.ninja')" />
<Exec Command="ninja -C $(EscapedIntermediateOutputPath)win_x86 :jingle_peerconnection_so" />
<Copy DestinationFolder="$(OutputPath)Runtime/x86" SourceFiles="$(IntermediateOutputPath)win_x86/jingle_peerconnection_so.dll" />
</Target>
<Target Name="Restore">
<MSBuild
Projects="../webrtc/webrtc.csproj"
Expand Down
Loading