diff --git a/README.md b/README.md
index 70142511f..4778e30e4 100644
--- a/README.md
+++ b/README.md
@@ -32,17 +32,17 @@ The following dependencies are for Windows only:
- Create a file named .gclient in the directory above the `src` dir, with these contents:
```
-solutions = [
- {
- "managed": False,
- "name": "src",
- "url": "https://github.com/open-webrtc-toolkit/owt-client-native.git",
- "custom_deps": {},
- "deps_file": "DEPS",
- "safesync_url": "",
- },
-]
-target_os = []
+solutions = [
+ {
+ "managed": False,
+ "name": "src",
+ "url": "https://github.com/open-webrtc-toolkit/owt-client-native.git",
+ "custom_deps": {},
+ "deps_file": "DEPS",
+ "safesync_url": "",
+ },
+]
+target_os = []
```
### Build
@@ -67,7 +67,8 @@ Common build options shared by Windows and Linux:
- The built binary will be under path specified by `--output_path`. If `--output_path` is not set, the built binary will be under `src/out` directory.
- The optional `--ssl_root` should be set to the root directory of lastest OpenSSL 1.1.1 binary. If specified, SDK will link to external openssl library instead of boringssl.
- Use `--gn_gen` to generate args.gn during the first build or when you change either `ssl_root`/`msdk_root`/`quic_root` options.
- - The optional `--quic_root` should point to the directory containing QUIC library pre-built from owt-sdk-quic repo. This will build the SDK with QUIC enabled for conference mode.
+ - The optional `--quic_root` should point to the directory containing WebTransport library pre-built from owt-sdk-quic repo. This will build the SDK with WebTransport enabled for
+ conference mode. Refer to [README.webtransport](https://github.com/open-webrtc-toolkit/owt-client-native/blob/main/README.webtransport) for the version of webtransport library to be used.
- The optional `--tests` will trigger unit tests after build.
#### iOS
diff --git a/README.webtransport b/README.webtransport
new file mode 100644
index 000000000..24d4e4594
--- /dev/null
+++ b/README.webtransport
@@ -0,0 +1,4 @@
+WebTransport SDK version:
+===================================
+Repo URL: https://github.com/open-webrtc-toolkit/owt-sdk-quic
+Revision: c53899b14b5b24e796ad51bd36c8d02ddb8cde48
\ No newline at end of file
diff --git a/talk/owt/BUILD.gn b/talk/owt/BUILD.gn
index da66d208d..bcfdde570 100644
--- a/talk/owt/BUILD.gn
+++ b/talk/owt/BUILD.gn
@@ -5,9 +5,15 @@
import("//build_overrides/webrtc.gni")
import("//testing/test.gni")
+declare_args() {
+ include_internal_audio_device = true
+ owt_msdk_lib_root = ""
+ owt_msdk_header_root = ""
+}
+
# Introduced for using libvpx config files. We only enable libvpx rate
# controller for VP9 on Windows.
-if (is_win) {
+if (is_win && owt_msdk_header_root != "") {
if (current_cpu == "x86") {
cpu_arch_full = "ia32"
@@ -26,19 +32,17 @@ if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
+
if (is_ios) {
import("//build/config/ios/rules.gni")
}
-declare_args() {
- include_internal_audio_device = true
- owt_msdk_lib_root = ""
- owt_msdk_header_root = ""
-}
+
if (is_ios || is_mac) {
config("owt_sdk_objc_warnings_config") {
cflags_objc = [ "-Wstrict-prototypes" ]
}
}
+
if (is_android) {
config("libjingle_peerconnection_jni_warnings_config") {
# The warnings below are enabled by default. Since GN orders compiler flags
@@ -52,6 +56,7 @@ if (is_android) {
}
}
}
+
static_library("owt_deps") {
deps = [
"//third_party/webrtc/api:create_peerconnection_factory",
@@ -66,6 +71,7 @@ static_library("owt_deps") {
}
complete_static_lib = true
}
+
if (!is_ios) {
static_library("owt") {
deps = [
diff --git a/talk/owt/docs/cpp/cpp.md b/talk/owt/docs/cpp/cpp.md
index fc6bb59cf..f3969fa56 100644
--- a/talk/owt/docs/cpp/cpp.md
+++ b/talk/owt/docs/cpp/cpp.md
@@ -7,14 +7,14 @@ This SDK is interoperable with Open WebRTC Toolkit Client SDK for JavaScript\*,
Refer to the Release Notes for the latest information in the SDK release package, including features,
bug fixes and known issues.
# 2 Supported platforms {#section2}
-Open WebRTC Toolkit Client SDK for Windows supports Windows 7 and later versions.
+Open WebRTC Toolkit Client SDK for Windows supports Windows 8 and later versions.
# 3 Getting started {#section3}
Application on Open WebRTC Toolkit Client SDK for Windows should be built with Microsoft Visual Studio\* 2017 or 2019. Running time library for linking should be `Multi-threaded Debug (/MTd)` for debug version or `Multi-threaded (/MT)` for release version. Supported platform is x64.
The release package includes one sample application to get you started quickly with the SDK. The following two static libraries are provided in the SDK for only x64, along with their headers:
- owt-debug.lib - this library includes all the WebRTC features for debug usages.
- owt-release.lib - this library includes all the WebRTC features for release usages.
owt-debug.lib|owt-release references libraries in Windows SDK for DXVA support. Your application must statically link
-mfuuid.lib, mf.lib, mfplat.lib, d3d9.lib, dxgi.lib, d3d11.lib and dxva2.lib to build. Depending on your signaling
+mfuuid.lib, mf.lib, mfplat.lib, d3d9.lib, dxgi.lib, d3d11.lib, dcomp.lib and dxva2.lib to build. Depending on your signaling
channel implementation, you can optionally link sioclient.lib or sioclient_tls.lib if neccessary.
# 4 Socket.IO {#section4}
Socket.IO cpp client is an open source project hosted on [Github](https://github.com/socketio/socket.io-client-cpp). Please follow official guide on GitHub to build and link it. The version works with OWT is b1216ee428dd7d1e72368da9b12aa43bfc487c93.
@@ -29,8 +29,8 @@ for P2P sessions can be customized by implementing `P2PSignalingChannelInterface
can invoke its methods to notify `PeerClient` during your customized signaling channel implementation when a new
message is coming or connection is lost.
# 7 Video codecs {#section7}
-For the decoder, if hardware acceleration is not enabled, only VP8/VP9 is supported. If hardware acceleration is enabled, VP8,
-VP9, H.264 and HEVC are supported, but it will fallback to VP8 software decoder if GPU does not supports VP8 hardware decoding.
+For the decoder, if hardware acceleration is not enabled, only VP8/VP9/AV1 is supported. If hardware acceleration is enabled, VP8,
+VP9, H.264, HEVC and AV1 are supported, but it will fallback to VP8 software decoder if GPU does not supports VP8 hardware decoding.
Most of the 5th-11th Generation Intel® Core(TM) Processor platforms support VP8 hardware decoding, refer to their specific documentation for details.
Starting from 6th Generation Intel® Core(TM) Processor platforms, hardware encoding and decoding of HEVC is supported.
You can turn off video encoding/decoding hardware acceleration via {@link owt.base.GlobalConfiguration GlobalConfiguration} API,
diff --git a/talk/owt/sdk/base/stream.cc b/talk/owt/sdk/base/stream.cc
index dc17a4c04..fca04fe94 100644
--- a/talk/owt/sdk/base/stream.cc
+++ b/talk/owt/sdk/base/stream.cc
@@ -720,17 +720,13 @@ MediaStreamInterface* RemoteStream::MediaStream() {
}
#ifdef OWT_ENABLE_QUIC
-QuicStream::QuicStream(owt::quic::QuicTransportStreamInterface* quic_stream,
+QuicStream::QuicStream(owt::quic::WebTransportStreamInterface* quic_stream,
const std::string& session_id)
: quic_stream_(quic_stream), session_id_(session_id), can_read_(true),
can_write_(true), fin_read_(false) {
}
QuicStream::~QuicStream() {
- if (quic_stream_) {
- delete quic_stream_;
- quic_stream_ = nullptr;
- }
}
size_t QuicStream::Write(uint8_t* data, size_t length) {
diff --git a/talk/owt/sdk/conference/conferenceclient.cc b/talk/owt/sdk/conference/conferenceclient.cc
index b5507dd68..91b8065c3 100644
--- a/talk/owt/sdk/conference/conferenceclient.cc
+++ b/talk/owt/sdk/conference/conferenceclient.cc
@@ -255,7 +255,7 @@ void ConferenceClient::OnConnectionFailed() {
}
void ConferenceClient::OnIncomingStream(const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream) {
+ owt::quic::WebTransportStreamInterface* stream) {
RTC_LOG(LS_INFO) << "Quic client received a stream on session:" << session_id;
// Check if the subscription exists for this stream. Trigger immediately
// if exists. Otherwise push to pending list.
@@ -1046,11 +1046,11 @@ void ConferenceClient::Leave(
}
#ifdef OWT_ENABLE_QUIC
{
- std::lock_guard lock(quic_publications_mutex_);
+ // Do not hold the lock of quic_publications_ as only Stop
+ // will remove the publications from list.
for (auto& publication : quic_publications_) {
publication.second->Stop();
}
- quic_publications_.clear();
}
{
std::lock_guard lock(quic_subscriptions_mutex_);
@@ -1725,7 +1725,7 @@ void ConferenceClient::TriggerOnUserLeft(sio::message::ptr user_info) {
#ifdef OWT_ENABLE_QUIC
void ConferenceClient::TriggerOnIncomingStream(
const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream) {
+ owt::quic::WebTransportStreamInterface* stream) {
const std::lock_guard lock(stream_update_observer_mutex_);
for (auto its = stream_update_observers_.begin();
its != stream_update_observers_.end(); ++its) {
diff --git a/talk/owt/sdk/conference/conferencesubscription.cc b/talk/owt/sdk/conference/conferencesubscription.cc
index 9632a82f6..ac0c3e16e 100644
--- a/talk/owt/sdk/conference/conferencesubscription.cc
+++ b/talk/owt/sdk/conference/conferencesubscription.cc
@@ -211,7 +211,7 @@ void ConferenceSubscription::OnStreamError(const std::string& error_msg) {
#ifdef OWT_ENABLE_QUIC
void ConferenceSubscription::OnIncomingStream(const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream) {
+ owt::quic::WebTransportStreamInterface* stream) {
if (ended_ || stream_id_ != session_id)
return;
quic_stream_ = std::make_shared(stream, session_id);
diff --git a/talk/owt/sdk/conference/conferencewebtransportchannel.cc b/talk/owt/sdk/conference/conferencewebtransportchannel.cc
index cc2ce504c..8b3be6a5b 100644
--- a/talk/owt/sdk/conference/conferencewebtransportchannel.cc
+++ b/talk/owt/sdk/conference/conferencewebtransportchannel.cc
@@ -16,10 +16,7 @@
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/string_utils.h"
-#include "owt/quic/quic_definitions.h"
-#include "owt/quic/quic_transport_client_interface.h"
-#include "owt/quic/quic_transport_factory.h"
-#include "owt/quic/quic_transport_stream_interface.h"
+#include "owt/quic/web_transport_definitions.h"
using namespace rtc;
using namespace owt::quic;
@@ -28,13 +25,19 @@ namespace owt {
namespace conference {
using std::string;
-// Stream option member key
+// Stream option member keys
const std::string kStreamOptionStreamIdKey = "streamId";
const std::string kStreamOptionStateKey = "state";
const std::string kStreamOptionDataKey = "type";
const std::string kStreamOptionWebTransportKey = "data";
const std::string kStreamOptionAttributesKey = "attributes";
-#define QUIC_CERT_FINGERPRINT_SIZE 32
+
+static constexpr int kWebTransportCertFingerprintSize = 32;
+// Timeout for retrieving subscription session id.
+static constexpr int kWebTransportSubSessionIdTimeoutMs = 20;
+// Total retries for retreiving subscription session id.
+static constexpr int kWebTransportSubSessionIdRetries = 5;
+static constexpr int kWebTransportSubSessionIdLengthPlus1 = 33;
ConferenceWebTransportChannel::ConferenceWebTransportChannel(
const ConferenceClientConfiguration& configuration,
@@ -50,14 +53,12 @@ ConferenceWebTransportChannel::ConferenceWebTransportChannel(
url_(url),
transport_id_(webtransport_id),
webtransport_token_(webtransport_token) {
- quic_transport_factory_.reset(owt::quic::QuicTransportFactory::Create());
- quic_client_connected_ = false;
- auth_cv_ = std::make_unique();
RTC_CHECK(signaling_channel_);
+ quic_transport_factory_.reset(owt::quic::WebTransportFactory::Create());
+ quic_client_connected_ = false;
}
ConferenceWebTransportChannel::~ConferenceWebTransportChannel() {
- RTC_LOG(LS_INFO) << "Deconstruct conference WebTransport channel";
// We will rely on conference client to stop all publications/subscriptions.
if (quic_client_connected_ && quic_transport_client_) {
quic_transport_client_->Close();
@@ -81,6 +82,7 @@ void ConferenceWebTransportChannel::Authenticate() {
memcpy(&signaling_stream_id[0], &token_size, sizeof(uint32_t));
auth_stream_->Write(&signaling_stream_id[0], sizeof(uint32_t));
auth_stream_->Write((uint8_t*)(webtransport_token_.c_str()), token_size);
+ // Server will return transportID as an ack. Ignored by client.
}
void ConferenceWebTransportChannel::Connect() {
@@ -88,24 +90,29 @@ void ConferenceWebTransportChannel::Connect() {
configuration_.trusted_quic_certificate_fingerprints;
size_t cert_fingerprint_size = trusted_fingerprints.size();
- owt::quic::QuicTransportClientInterface::Parameters quic_params;
+ owt::quic::WebTransportClientInterface::Parameters quic_params;
memset(&quic_params, 0, sizeof(quic_params));
- owt::quic::CertificateFingerprint* fingerprint = nullptr;
if (cert_fingerprint_size > 0) {
- fingerprint = new owt::quic::CertificateFingerprint[cert_fingerprint_size];
- quic_params.server_certificate_fingerprints = &fingerprint;
+ fingerprint_ = new owt::quic::CertificateFingerprint[cert_fingerprint_size];
+ quic_params.server_certificate_fingerprints = &fingerprint_;
quic_params.server_certificate_fingerprints_length = cert_fingerprint_size;
}
int fingerprint_idx = 0;
for (auto fingerprint : trusted_fingerprints) {
+ char* current_sha256 = new char[fingerprint.length() + 1];
+ {
+ const std::lock_guard lock(fingerprints_mutex_);
+ fingerprint_sha256_values_.push_back(current_sha256);
+ }
+ current_sha256[fingerprint.length()] = '\0';
+ memcpy((void*)current_sha256,
+ fingerprint.c_str(), fingerprint.length());
quic_params.server_certificate_fingerprints[fingerprint_idx]->fingerprint =
- new char[fingerprint.length()+1];
- memcpy((void*)(quic_params.server_certificate_fingerprints[fingerprint_idx]->fingerprint),
- fingerprint.c_str(), fingerprint.length()+1);
+ current_sha256;
}
RTC_LOG(LS_INFO) << "Creating Quic transport client.";
- quic_transport_client_.reset(quic_transport_factory_->CreateQuicTransportClient(
+ quic_transport_client_.reset(quic_transport_factory_->CreateWebTransportClient(
url_.c_str(), quic_params));
if (quic_transport_client_.get()) {
quic_transport_client_->SetVisitor(this);
@@ -342,15 +349,23 @@ std::function ConferenceWebTransportChannel::RunInEventQueue(
};
}
+// OnConnected is invoked in WebTransportClient's event loop.
void ConferenceWebTransportChannel::OnConnected() {
RTC_LOG(LS_ERROR) << "Quic client connected.";
-#ifdef OWT_QUIC_ASYNC_AUTHENTICATION
{
- std::unique_lock lock(auth_mutex_);
- auth_cv_->notify_one();
+ const std::lock_guard lock(fingerprints_mutex_);
+ for (auto fingerprint : fingerprint_sha256_values_) {
+ if (fingerprint) {
+ delete fingerprint;
+ fingerprint = nullptr;
+ }
+ }
+ fingerprint_sha256_values_.clear();
+ }
+ if (fingerprint_) {
+ delete[] fingerprint_;
+ fingerprint_ = nullptr;
}
-#endif
-
AuthenticateCallback();
quic_client_connected_ = true;
if (observer_) {
@@ -360,25 +375,39 @@ void ConferenceWebTransportChannel::OnConnected() {
void ConferenceWebTransportChannel::OnConnectionFailed() {
RTC_LOG(LS_INFO) << "Quic client disconnected.";
+ {
+ const std::lock_guard lock(fingerprints_mutex_);
+ for (auto fingerprint : fingerprint_sha256_values_) {
+ if (fingerprint) {
+ delete fingerprint;
+ fingerprint = nullptr;
+ }
+ }
+ fingerprint_sha256_values_.clear();
+ }
+ if (fingerprint_) {
+ delete[] fingerprint_;
+ fingerprint_ = nullptr;
+ }
quic_client_connected_ = false;
if (observer_) {
observer_->OnConnectionFailed();
}
}
-#ifdef OWT_ENABLE_QUIC
static std::string ConvertToUUID(uint8_t* src) {
-#define UUID_TEXT_LEN_PLUS_1 33
if (!src)
return "";
- char* dst = new char[UUID_TEXT_LEN_PLUS_1];
- memset(dst, 0, UUID_TEXT_LEN_PLUS_1);
- int bytes_written = snprintf(dst, UUID_TEXT_LEN_PLUS_1,
+ char* dst = new char[kWebTransportSubSessionIdLengthPlus1];
+ memset(dst, 0, kWebTransportSubSessionIdLengthPlus1);
+ int bytes_written = snprintf(
+ dst, kWebTransportSubSessionIdLengthPlus1,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7],
src[8], src[9], src[10], src[11], src[12], src[13], src[14],
src[15]);
- if (bytes_written <= 0 || bytes_written > UUID_TEXT_LEN_PLUS_1) {
+ if (bytes_written <= 0 ||
+ bytes_written > kWebTransportSubSessionIdLengthPlus1) {
delete []dst;
return "";
}
@@ -386,18 +415,15 @@ static std::string ConvertToUUID(uint8_t* src) {
delete []dst;
return uuid;
}
-#endif
// This gets called for subscription case. After sucessful
-// subscribe signaling, MCU will create the send stream on
+// subscribe signaling, server will create the send stream on
// server side, and this results in client's OnIncomingStream
-// to be invoked. MCU will further send the session id on the
+// to be invoked. Server will further send the session id on the
// incoming stream. This will be used to associate the stream
// with subscription.
void ConferenceWebTransportChannel::OnIncomingStream(
- owt::quic::QuicTransportStreamInterface* stream) {
-#define SUB_SESSION_ID_TIEMOUT_MS 20
-#define SUB_SESSION_ID_RETRIES 5
+ owt::quic::WebTransportStreamInterface* stream) {
// At the time of this callback, the session id may still be unknown.
// We will need to wait until we read it over signaling session.
RTC_LOG(LS_INFO) << "Received incoming quic stream.";
@@ -405,7 +431,7 @@ void ConferenceWebTransportChannel::OnIncomingStream(
new owt::conference::ConferenceWebTransportChannel::IncomingStreamObserver(this, stream);
stream->SetVisitor(stream_observer);
- int max_retries = SUB_SESSION_ID_RETRIES;
+ int max_retries = kWebTransportSubSessionIdRetries;
while (max_retries > 0) {
if (stream->ReadableBytes() >= 16) {
uint8_t* session_bin = new uint8_t[16];
@@ -419,13 +445,13 @@ void ConferenceWebTransportChannel::OnIncomingStream(
} else {
max_retries--;
std::this_thread::sleep_for(
- std::chrono::microseconds(SUB_SESSION_ID_TIEMOUT_MS));
+ std::chrono::microseconds(kWebTransportSubSessionIdTimeoutMs));
}
}
}
void ConferenceWebTransportChannel::OnStreamSessionId(const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream) {
+ owt::quic::WebTransportStreamInterface* stream) {
if (observer_) {
observer_->OnIncomingStream(session_id, stream);
}
@@ -450,7 +476,7 @@ void ConferenceWebTransportChannel::CreateSendStream(
return;
}
// Sychronous call for creating the stream.
- owt::quic::QuicTransportStreamInterface* quic_stream =
+ owt::quic::WebTransportStreamInterface* quic_stream =
quic_transport_client_->CreateBidirectionalStream();
// For local stream session id is not specified at stream creation time.
std::shared_ptr writable_stream =
diff --git a/talk/owt/sdk/conference/conferencewebtransportchannel.h b/talk/owt/sdk/conference/conferencewebtransportchannel.h
index 2428ddfb6..98e6ffcf4 100644
--- a/talk/owt/sdk/conference/conferencewebtransportchannel.h
+++ b/talk/owt/sdk/conference/conferencewebtransportchannel.h
@@ -21,9 +21,9 @@
#include "talk/owt/sdk/include/cpp/owt/conference/subscribeoptions.h"
#include "talk/owt/sdk/include/cpp/owt/conference/conferencepublication.h"
#include "talk/owt/sdk/include/cpp/owt/conference/conferenceclient.h"
-#include "owt/quic/quic_transport_client_interface.h"
-#include "owt/quic/quic_transport_factory.h"
-#include "owt/quic/quic_transport_stream_interface.h"
+#include "owt/quic/web_transport_client_interface.h"
+#include "owt/quic/web_transport_factory.h"
+#include "owt/quic/web_transport_stream_interface.h"
namespace owt {
namespace conference {
@@ -32,7 +32,7 @@ using namespace owt::quic;
// An instance of ConferenceWebTransportChannel manages a WebTransport channel with
// MCU as well as its signaling through Socket.IO.
-class ConferenceWebTransportChannel: public owt::quic::QuicTransportClientInterface::Visitor,
+class ConferenceWebTransportChannel: public owt::quic::WebTransportClientInterface::Visitor,
public std::enable_shared_from_this {
public:
explicit ConferenceWebTransportChannel(
@@ -44,7 +44,7 @@ class ConferenceWebTransportChannel: public owt::quic::QuicTransportClientInterf
std::shared_ptr event_queue);
~ConferenceWebTransportChannel();
class AuthStreamObserver
- : public owt::quic::QuicTransportStreamInterface::Visitor {
+ : public owt::quic::WebTransportStreamInterface::Visitor {
public:
AuthStreamObserver(ConferenceWebTransportChannel* channel)
: channel_(channel) {}
@@ -61,9 +61,9 @@ class ConferenceWebTransportChannel: public owt::quic::QuicTransportClientInterf
bool authenticated_ = false;
};
class IncomingStreamObserver
- : public owt::quic::QuicTransportStreamInterface::Visitor {
+ : public owt::quic::WebTransportStreamInterface::Visitor {
public:
- IncomingStreamObserver(ConferenceWebTransportChannel* channel, owt::quic::QuicTransportStreamInterface* stream)
+ IncomingStreamObserver(ConferenceWebTransportChannel* channel, owt::quic::WebTransportStreamInterface* stream)
: channel_(channel)
, stream_(stream) {}
virtual void OnCanRead() {}
@@ -71,7 +71,7 @@ class ConferenceWebTransportChannel: public owt::quic::QuicTransportClientInterf
virtual void OnFinRead() {}
public:
ConferenceWebTransportChannel* channel_;
- owt::quic::QuicTransportStreamInterface* stream_;
+ owt::quic::WebTransportStreamInterface* stream_;
};
// Connect asynchronously to WebTransport server.
void Connect();
@@ -114,12 +114,12 @@ class ConferenceWebTransportChannel: public owt::quic::QuicTransportClientInterf
// TODO: define stats API
void OnStreamError(const std::string& error_message);
private:
- // Implements owt::quic::QuicTransportClientInterface::Visitor
+ // Implements owt::quic::WebTransportClientInterface::Visitor
void OnConnected();
void OnConnectionFailed();
- void OnIncomingStream(QuicTransportStreamInterface*);
+ void OnIncomingStream(WebTransportStreamInterface*);
void OnStreamSessionId(const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream);
+ owt::quic::WebTransportStreamInterface* stream);
bool CheckNullPointer(
uintptr_t pointer,
std::function)> on_failure);
@@ -144,9 +144,9 @@ class ConferenceWebTransportChannel: public owt::quic::QuicTransportClientInterf
bool connected_;
// Queue for callbacks and events.
std::shared_ptr event_queue_;
- std::unique_ptr quic_transport_factory_;
- std::unique_ptr quic_transport_client_;
- // Each conference client will be associated with one quic_transport_channel_
+ std::unique_ptr quic_transport_factory_;
+ std::unique_ptr quic_transport_client_;
+ // Each conference client will be associated with one web_transport_channel_
// instance.
std::shared_ptr quic_transport_channel_;
std::atomic quic_client_connected_;
@@ -154,14 +154,16 @@ class ConferenceWebTransportChannel: public owt::quic::QuicTransportClientInterf
std::string transport_id_;
std::string webtransport_token_; // base64 encoded webTransportToken recevied
// after joining.
- QuicTransportStreamInterface* auth_stream_ = nullptr;
+ WebTransportStreamInterface* auth_stream_ = nullptr;
+ // Trusted certificates' fingerprints
+ owt::quic::CertificateFingerprint* fingerprint_ = nullptr;
+ std::vector fingerprint_sha256_values_;
+ mutable std::mutex fingerprints_mutex_;
std::unique_ptr auth_stream_observer_;
std::vector published_session_ids_;
mutable std::mutex published_session_ids_mutex_;
std::vector subscribed_session_ids_;
mutable std::mutex subscribed_session_ids_mutex_;
- mutable std::mutex auth_mutex_;
- std::unique_ptr auth_cv_;
};
}
}
diff --git a/talk/owt/sdk/include/cpp/owt/base/stream.h b/talk/owt/sdk/include/cpp/owt/base/stream.h
index a866ef4c3..c0b9350b0 100644
--- a/talk/owt/sdk/include/cpp/owt/base/stream.h
+++ b/talk/owt/sdk/include/cpp/owt/base/stream.h
@@ -17,7 +17,7 @@
#include "owt/base/videorendererinterface.h"
#include "owt/base/audioplayerinterface.h"
#ifdef OWT_ENABLE_QUIC
-#include "owt/quic/quic_transport_stream_interface.h"
+#include "owt/quic/web_transport_stream_interface.h"
#endif
namespace webrtc {
@@ -178,9 +178,9 @@ class Stream {
/// A QuicStream can be fetched from a published LocalStream for data,
/// on which you can write to server;
/// Or from a subscription from server for data, on which you can read.
-class QuicStream : public owt::quic::QuicTransportStreamInterface::Visitor {
+class QuicStream : public owt::quic::WebTransportStreamInterface::Visitor {
public:
- QuicStream(owt::quic::QuicTransportStreamInterface* quic_stream,
+ QuicStream(owt::quic::WebTransportStreamInterface* quic_stream,
const std::string& session_id);
~QuicStream();
@@ -207,7 +207,7 @@ class QuicStream : public owt::quic::QuicTransportStreamInterface::Visitor {
@return Bytes of data available on the stream.
*/
size_t ReadableBytes() const;
- void SetVisitor(owt::quic::QuicTransportStreamInterface::Visitor* visitor) {
+ void SetVisitor(owt::quic::WebTransportStreamInterface::Visitor* visitor) {
if (quic_stream_ && visitor) {
quic_stream_->SetVisitor(visitor);
}
@@ -228,7 +228,8 @@ class QuicStream : public owt::quic::QuicTransportStreamInterface::Visitor {
}
/** @endcond */
private:
- owt::quic::QuicTransportStreamInterface* quic_stream_;
+ // Owned by WebTransportClientImpl.
+ owt::quic::WebTransportStreamInterface* quic_stream_;
std::string session_id_;
std::atomic can_read_;
std::atomic can_write_;
diff --git a/talk/owt/sdk/include/cpp/owt/base/subscription.h b/talk/owt/sdk/include/cpp/owt/base/subscription.h
index 6e9cab78e..1717d6f5d 100644
--- a/talk/owt/sdk/include/cpp/owt/base/subscription.h
+++ b/talk/owt/sdk/include/cpp/owt/base/subscription.h
@@ -6,7 +6,7 @@
#include "owt/base/commontypes.h"
#include "owt/base/mediaconstraints.h"
#ifdef OWT_ENABLE_QUIC
-#include "owt/quic/quic_transport_stream_interface.h"
+#include "owt/quic/web_transport_stream_interface.h"
#endif
namespace owt {
namespace base {
diff --git a/talk/owt/sdk/include/cpp/owt/conference/conferenceclient.h b/talk/owt/sdk/include/cpp/owt/conference/conferenceclient.h
index 95d74124b..3cb04c520 100644
--- a/talk/owt/sdk/include/cpp/owt/conference/conferenceclient.h
+++ b/talk/owt/sdk/include/cpp/owt/conference/conferenceclient.h
@@ -22,7 +22,7 @@
#include "owt/conference/streamupdateobserver.h"
#include "owt/conference/subscribeoptions.h"
#ifdef OWT_ENABLE_QUIC
-#include "owt/quic/quic_transport_stream_interface.h"
+#include "owt/quic/web_transport_stream_interface.h"
#endif
namespace sio{
class message;
@@ -209,7 +209,7 @@ class ConferenceWebTransportChannelObserver {
// Called when an incoming stream is received by QUIC channel
virtual void OnIncomingStream(
const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream) = 0;
+ owt::quic::WebTransportStreamInterface* stream) = 0;
};
#endif
/** @endcond */
@@ -445,7 +445,7 @@ class ConferenceClient final
void OnConnected();
void OnConnectionFailed();
void OnIncomingStream(const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream);
+ owt::quic::WebTransportStreamInterface* stream);
#endif
/// Return true if |pointer| is not a null pointer, else return false and
@@ -476,7 +476,7 @@ class ConferenceClient final
std::shared_ptr exception);
#ifdef OWT_ENABLE_QUIC
void TriggerOnIncomingStream(const std::string& session_id,
- owt::quic::QuicTransportStreamInterface* stream);
+ owt::quic::WebTransportStreamInterface* stream);
#endif
// Return true if |user_info| is correct, and |*participant| points to the participant
// object
@@ -529,17 +529,19 @@ class ConferenceClient final
mutable std::mutex stream_update_observer_mutex_;
std::vector > stream_update_observers_;
#ifdef OWT_ENABLE_QUIC
- // Each conference client will be associated with one quic_transport_channel_ instance.
+ // Each conference client will be associated with only one quic_transport_channel_ instance.
std::shared_ptr web_transport_channel_;
std::atomic web_transport_channel_connected_;
std::string webtransport_id_; // transportId used for publish/subscribe.
- std::string webtransport_token_; // base64 encoded webTransportToken recevied after joining. key is session_id(publication_id)
+ // base64 encoded webTransportToken recevied after joining. key is
+ // session_id(publication_id)
+ std::string webtransport_token_;
std::map> quic_publications_;
mutable std::mutex quic_publications_mutex_;
// key is session_id(subscription_id)
std::map> quic_subscriptions_;
mutable std::mutex quic_subscriptions_mutex_;
- std::unordered_map
+ std::unordered_map
pending_incoming_streams_;
mutable std::mutex pending_quic_streams_mutex_;
#endif
diff --git a/talk/owt/sdk/include/cpp/owt/conference/conferencesubscription.h b/talk/owt/sdk/include/cpp/owt/conference/conferencesubscription.h
index d0a41c1a9..28e1dae2c 100644
--- a/talk/owt/sdk/include/cpp/owt/conference/conferencesubscription.h
+++ b/talk/owt/sdk/include/cpp/owt/conference/conferencesubscription.h
@@ -78,7 +78,7 @@ class ConferenceSubscription : public ConferenceStreamUpdateObserver,
void OnStreamRemoved(const std::string& stream_id);
void OnStreamError(const std::string& error_msg);
#ifdef OWT_ENABLE_QUIC
- void OnIncomingStream(const std::string& session_id, owt::quic::QuicTransportStreamInterface* stream);
+ void OnIncomingStream(const std::string& session_id, owt::quic::WebTransportStreamInterface* stream);
#endif
std::string id_;
std::string stream_id_;
diff --git a/talk/owt/sdk/include/cpp/owt/conference/streamupdateobserver.h b/talk/owt/sdk/include/cpp/owt/conference/streamupdateobserver.h
index 45d788bd9..d0a63c82a 100644
--- a/talk/owt/sdk/include/cpp/owt/conference/streamupdateobserver.h
+++ b/talk/owt/sdk/include/cpp/owt/conference/streamupdateobserver.h
@@ -5,7 +5,7 @@
#define OWT_CONFERENCE_STREAMUPDATEOBSERVER_H
#include "owt/base/commontypes.h"
#ifdef OWT_ENABLE_QUIC
-#include "owt/quic/quic_transport_stream_interface.h"
+#include "owt/quic/web_transport_stream_interface.h"
#endif
namespace owt {
namespace conference {
@@ -22,7 +22,7 @@ class ConferenceStreamUpdateObserver {
virtual void OnStreamError(const std::string& error_msg){}
#ifdef OWT_ENABLE_QUIC
virtual void OnIncomingStream(
- const std::string& session_id, owt::quic::QuicTransportStreamInterface* stream) {}
+ const std::string& session_id, owt::quic::WebTransportStreamInterface* stream) {}
#endif
};
/** @endcond */