Enable the use of CreateDataChannel with a DataChannelInit config.
Change-Id: Ie9b783464c7b4f6c2d5624a96221f266531acbe9 Bug: b/267359410 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/292861 Reviewed-by: Artem Titov <titovartem@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Jeremy Leconte <jleconte@google.com> Cr-Commit-Position: refs/heads/main@{#39293}
This commit is contained in:
parent
05873dcaa6
commit
eccd93e892
@ -2269,6 +2269,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"../rtc_base:logging",
|
||||
"../test:test_support",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
rtc_test("slow_peer_connection_unittests") {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/function_view.h"
|
||||
#include "api/set_remote_description_observer_interface.h"
|
||||
#include "pc/sdp_utils.h"
|
||||
@ -312,8 +313,11 @@ rtc::scoped_refptr<RtpSenderInterface> PeerConnectionWrapper::AddVideoTrack(
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<DataChannelInterface>
|
||||
PeerConnectionWrapper::CreateDataChannel(const std::string& label) {
|
||||
auto result = pc()->CreateDataChannelOrError(label, nullptr);
|
||||
PeerConnectionWrapper::CreateDataChannel(
|
||||
const std::string& label,
|
||||
const absl::optional<DataChannelInit>& config) {
|
||||
const DataChannelInit* config_ptr = config.has_value() ? &(*config) : nullptr;
|
||||
auto result = pc()->CreateDataChannelOrError(label, config_ptr);
|
||||
if (!result.ok()) {
|
||||
RTC_LOG(LS_ERROR) << "CreateDataChannel failed: "
|
||||
<< ToString(result.error().type()) << " "
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/data_channel_interface.h"
|
||||
#include "api/function_view.h"
|
||||
#include "api/jsep.h"
|
||||
@ -169,7 +170,8 @@ class PeerConnectionWrapper {
|
||||
// Calls the underlying PeerConnection's CreateDataChannel method with default
|
||||
// initialization parameters.
|
||||
rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
|
||||
const std::string& label);
|
||||
const std::string& label,
|
||||
const absl::optional<DataChannelInit>& config = absl::nullopt);
|
||||
|
||||
// Returns the signaling state of the underlying PeerConnection.
|
||||
PeerConnectionInterface::SignalingState signaling_state();
|
||||
|
||||
@ -80,6 +80,7 @@ if (!build_with_chromium) {
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
"//third_party/abseil-cpp/absl/types:variant",
|
||||
]
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/function_view.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/sequence_checker.h"
|
||||
@ -109,9 +110,10 @@ class TestPeer final : public StatsProvider {
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
|
||||
const std::string& label) {
|
||||
const std::string& label,
|
||||
const absl::optional<DataChannelInit>& config = absl::nullopt) {
|
||||
RTC_CHECK(wrapper_) << "TestPeer is already closed";
|
||||
return wrapper_->CreateDataChannel(label);
|
||||
return wrapper_->CreateDataChannel(label, config);
|
||||
}
|
||||
|
||||
PeerConnectionInterface::SignalingState signaling_state() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user