summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/examples/androidvoip
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/libwebrtc/examples/androidvoip/BUILD.gn2
-rw-r--r--third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.cc34
-rw-r--r--third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.h16
3 files changed, 23 insertions, 29 deletions
diff --git a/third_party/libwebrtc/examples/androidvoip/BUILD.gn b/third_party/libwebrtc/examples/androidvoip/BUILD.gn
index cea05ea128..d390815406 100644
--- a/third_party/libwebrtc/examples/androidvoip/BUILD.gn
+++ b/third_party/libwebrtc/examples/androidvoip/BUILD.gn
@@ -71,7 +71,7 @@ if (is_android) {
"//api/task_queue:default_task_queue_factory",
"//api/voip:voip_api",
"//api/voip:voip_engine_factory",
- "//rtc_base/third_party/sigslot:sigslot",
+ "//rtc_base/network:received_packet",
"//sdk/android:native_api_audio_device_module",
"//sdk/android:native_api_base",
"//sdk/android:native_api_jni",
diff --git a/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.cc b/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.cc
index 8a0a3badb9..69327990e0 100644
--- a/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.cc
+++ b/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.cc
@@ -313,8 +313,10 @@ void AndroidVoipClient::StartSession(JNIEnv* env) {
/*isSuccessful=*/false);
return;
}
- rtp_socket_->SignalReadPacket.connect(
- this, &AndroidVoipClient::OnSignalReadRTPPacket);
+ rtp_socket_->RegisterReceivedPacketCallback(
+ [&](rtc::AsyncPacketSocket* socket, const rtc::ReceivedPacket& packet) {
+ OnSignalReadRTPPacket(socket, packet);
+ });
rtcp_socket_.reset(rtc::AsyncUDPSocket::Create(voip_thread_->socketserver(),
rtcp_local_address_));
@@ -324,8 +326,10 @@ void AndroidVoipClient::StartSession(JNIEnv* env) {
/*isSuccessful=*/false);
return;
}
- rtcp_socket_->SignalReadPacket.connect(
- this, &AndroidVoipClient::OnSignalReadRTCPPacket);
+ rtcp_socket_->RegisterReceivedPacketCallback(
+ [&](rtc::AsyncPacketSocket* socket, const rtc::ReceivedPacket& packet) {
+ OnSignalReadRTCPPacket(socket, packet);
+ });
Java_VoipClient_onStartSessionCompleted(env_, j_voip_client_,
/*isSuccessful=*/true);
}
@@ -467,12 +471,11 @@ void AndroidVoipClient::ReadRTPPacket(const std::vector<uint8_t>& packet_copy) {
RTC_CHECK(result == webrtc::VoipResult::kOk);
}
-void AndroidVoipClient::OnSignalReadRTPPacket(rtc::AsyncPacketSocket* socket,
- const char* rtp_packet,
- size_t size,
- const rtc::SocketAddress& addr,
- const int64_t& timestamp) {
- std::vector<uint8_t> packet_copy(rtp_packet, rtp_packet + size);
+void AndroidVoipClient::OnSignalReadRTPPacket(
+ rtc::AsyncPacketSocket* socket,
+ const rtc::ReceivedPacket& packet) {
+ std::vector<uint8_t> packet_copy(packet.payload().begin(),
+ packet.payload().end());
voip_thread_->PostTask([this, packet_copy = std::move(packet_copy)] {
ReadRTPPacket(packet_copy);
});
@@ -492,12 +495,11 @@ void AndroidVoipClient::ReadRTCPPacket(
RTC_CHECK(result == webrtc::VoipResult::kOk);
}
-void AndroidVoipClient::OnSignalReadRTCPPacket(rtc::AsyncPacketSocket* socket,
- const char* rtcp_packet,
- size_t size,
- const rtc::SocketAddress& addr,
- const int64_t& timestamp) {
- std::vector<uint8_t> packet_copy(rtcp_packet, rtcp_packet + size);
+void AndroidVoipClient::OnSignalReadRTCPPacket(
+ rtc::AsyncPacketSocket* socket,
+ const rtc::ReceivedPacket& packet) {
+ std::vector<uint8_t> packet_copy(packet.payload().begin(),
+ packet.payload().end());
voip_thread_->PostTask([this, packet_copy = std::move(packet_copy)] {
ReadRTCPPacket(packet_copy);
});
diff --git a/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.h b/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.h
index e2f1c64590..1d9a13b29d 100644
--- a/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.h
+++ b/third_party/libwebrtc/examples/androidvoip/jni/android_voip_client.h
@@ -23,8 +23,8 @@
#include "api/voip/voip_engine.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/async_udp_socket.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/socket_address.h"
-#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "sdk/android/native_api/jni/scoped_java_ref.h"
@@ -40,8 +40,7 @@ namespace webrtc_examples {
// with consistent thread usage requirement with ProcessThread used
// within VoipEngine, as well as providing asynchronicity to the
// caller. AndroidVoipClient is meant to be used by Java through JNI.
-class AndroidVoipClient : public webrtc::Transport,
- public sigslot::has_slots<> {
+class AndroidVoipClient : public webrtc::Transport {
public:
// Returns a pointer to an AndroidVoipClient object. Clients should
// use this factory method to create AndroidVoipClient objects. The
@@ -122,17 +121,10 @@ class AndroidVoipClient : public webrtc::Transport,
const webrtc::PacketOptions& options) override;
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override;
- // Slots for sockets to connect to.
void OnSignalReadRTPPacket(rtc::AsyncPacketSocket* socket,
- const char* rtp_packet,
- size_t size,
- const rtc::SocketAddress& addr,
- const int64_t& timestamp);
+ const rtc::ReceivedPacket& packet);
void OnSignalReadRTCPPacket(rtc::AsyncPacketSocket* socket,
- const char* rtcp_packet,
- size_t size,
- const rtc::SocketAddress& addr,
- const int64_t& timestamp);
+ const rtc::ReceivedPacket& packet);
private:
AndroidVoipClient(JNIEnv* env,