mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 14:20:45 +01:00

This is a pure rename+move of PeerConnectionSimulcastMediaFlowTests. The reason for renaming is to reflect that a) this is an integration test, not a unit test, and b) not all of the tests use simulcast (some use a single encoding, i.e. singlecast or SVC). Shared helper functions between PeerConnectionEncodingsIntegrationTest and PeerConnectionSimulcastTests are placed in a test-only util file. # Already pass, no need to wait for chromium bots for webrtc testonly CL NOTRY=True Bug: webrtc:15063 Change-Id: Iec90d1a7ab712be1395c7644723422c8c6179974 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/300540 Reviewed-by: Jeremy Leconte <jleconte@google.com> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39799}
55 lines
1.8 KiB
C++
55 lines
1.8 KiB
C++
/*
|
|
* Copyright 2023 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "pc/test/simulcast_layer_util.h"
|
|
|
|
#include "absl/algorithm/container.h"
|
|
#include "rtc_base/checks.h"
|
|
|
|
namespace webrtc {
|
|
|
|
std::vector<cricket::SimulcastLayer> CreateLayers(
|
|
const std::vector<std::string>& rids,
|
|
const std::vector<bool>& active) {
|
|
RTC_DCHECK_EQ(rids.size(), active.size());
|
|
std::vector<cricket::SimulcastLayer> result;
|
|
absl::c_transform(rids, active, std::back_inserter(result),
|
|
[](const std::string& rid, bool is_active) {
|
|
return cricket::SimulcastLayer(rid, !is_active);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
std::vector<cricket::SimulcastLayer> CreateLayers(
|
|
const std::vector<std::string>& rids,
|
|
bool active) {
|
|
return CreateLayers(rids, std::vector<bool>(rids.size(), active));
|
|
}
|
|
|
|
RtpTransceiverInit CreateTransceiverInit(
|
|
const std::vector<cricket::SimulcastLayer>& layers) {
|
|
RtpTransceiverInit init;
|
|
for (const cricket::SimulcastLayer& layer : layers) {
|
|
RtpEncodingParameters encoding;
|
|
encoding.rid = layer.rid;
|
|
encoding.active = !layer.is_paused;
|
|
init.send_encodings.push_back(encoding);
|
|
}
|
|
return init;
|
|
}
|
|
|
|
cricket::SimulcastDescription RemoveSimulcast(SessionDescriptionInterface* sd) {
|
|
auto mcd = sd->description()->contents()[0].media_description();
|
|
auto result = mcd->simulcast_description();
|
|
mcd->set_simulcast_description(cricket::SimulcastDescription());
|
|
return result;
|
|
}
|
|
|
|
} // namespace webrtc
|