Add ability to enable AV sync in PC level tests
Bug: webrtc:11381 Change-Id: I223ff0a2b81632ee7cbbac5b722bb6a7d5f72f7e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168959 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30629}
This commit is contained in:
parent
8e7d4bfeef
commit
4a6f81829b
@ -353,6 +353,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
|
|||||||
"video:video_frame",
|
"video:video_frame",
|
||||||
"video_codecs:video_codecs_api",
|
"video_codecs:video_codecs_api",
|
||||||
"//third_party/abseil-cpp/absl/memory",
|
"//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:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
|
#include "absl/strings/string_view.h"
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/async_resolver_factory.h"
|
#include "api/async_resolver_factory.h"
|
||||||
#include "api/call/call_factory_interface.h"
|
#include "api/call/call_factory_interface.h"
|
||||||
#include "api/fec_controller.h"
|
#include "api/fec_controller.h"
|
||||||
@ -202,7 +204,7 @@ class PeerConnectionE2EQualityTestFixture {
|
|||||||
// each RtpEncodingParameters of RtpParameters of corresponding
|
// each RtpEncodingParameters of RtpParameters of corresponding
|
||||||
// RtpSenderInterface for this video stream.
|
// RtpSenderInterface for this video stream.
|
||||||
absl::optional<int> temporal_layers_count;
|
absl::optional<int> temporal_layers_count;
|
||||||
// Sets the maxiumum encode bitrate in bps. If this value is not set, the
|
// Sets the maximum encode bitrate in bps. If this value is not set, the
|
||||||
// encoder will be capped at an internal maximum value around 2 Mbps
|
// encoder will be capped at an internal maximum value around 2 Mbps
|
||||||
// depending on the resolution. This means that it will never be able to
|
// depending on the resolution. This means that it will never be able to
|
||||||
// utilize a high bandwidth link.
|
// utilize a high bandwidth link.
|
||||||
@ -225,6 +227,11 @@ class PeerConnectionE2EQualityTestFixture {
|
|||||||
absl::optional<std::string> output_dump_file_name;
|
absl::optional<std::string> output_dump_file_name;
|
||||||
// If true will display input and output video on the user's screen.
|
// If true will display input and output video on the user's screen.
|
||||||
bool show_on_screen = false;
|
bool show_on_screen = false;
|
||||||
|
// If specified, determines a sync group to which this video stream belongs.
|
||||||
|
// According to bugs.webrtc.org/4762 WebRTC supports synchronization only
|
||||||
|
// for pair of single audio and single video stream. Framework won't do any
|
||||||
|
// enforcements on this field.
|
||||||
|
absl::optional<std::string> sync_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Contains properties for audio in the call.
|
// Contains properties for audio in the call.
|
||||||
@ -248,6 +255,11 @@ class PeerConnectionE2EQualityTestFixture {
|
|||||||
cricket::AudioOptions audio_options;
|
cricket::AudioOptions audio_options;
|
||||||
// Sampling frequency of input audio data (from file or generated).
|
// Sampling frequency of input audio data (from file or generated).
|
||||||
int sampling_frequency_in_hz = 48000;
|
int sampling_frequency_in_hz = 48000;
|
||||||
|
// If specified, determines a sync group to which this audio stream belongs.
|
||||||
|
// According to bugs.webrtc.org/4762 WebRTC supports synchronization only
|
||||||
|
// for pair of single audio and single video stream. Framework won't do any
|
||||||
|
// enforcements on this field.
|
||||||
|
absl::optional<std::string> sync_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This class is used to fully configure one peer inside the call.
|
// This class is used to fully configure one peer inside the call.
|
||||||
|
|||||||
@ -148,6 +148,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Smoke) {
|
|||||||
[](PeerConfigurer* alice) {
|
[](PeerConfigurer* alice) {
|
||||||
VideoConfig video(640, 360, 30);
|
VideoConfig video(640, 360, 30);
|
||||||
video.stream_label = "alice-video";
|
video.stream_label = "alice-video";
|
||||||
|
video.sync_group = "alice-media";
|
||||||
alice->AddVideoConfig(std::move(video));
|
alice->AddVideoConfig(std::move(video));
|
||||||
|
|
||||||
AudioConfig audio;
|
AudioConfig audio;
|
||||||
@ -156,6 +157,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Smoke) {
|
|||||||
audio.input_file_name =
|
audio.input_file_name =
|
||||||
test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
|
test::ResourcePath("pc_quality_smoke_test_alice_source", "wav");
|
||||||
audio.sampling_frequency_in_hz = 48000;
|
audio.sampling_frequency_in_hz = 48000;
|
||||||
|
audio.sync_group = "alice-media";
|
||||||
alice->SetAudioConfig(std::move(audio));
|
alice->SetAudioConfig(std::move(audio));
|
||||||
},
|
},
|
||||||
[](PeerConfigurer* bob) {
|
[](PeerConfigurer* bob) {
|
||||||
@ -262,7 +264,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Svc) {
|
|||||||
"simulcast", run_params,
|
"simulcast", run_params,
|
||||||
[](PeerConfigurer* alice) {
|
[](PeerConfigurer* alice) {
|
||||||
VideoConfig simulcast(1280, 720, 30);
|
VideoConfig simulcast(1280, 720, 30);
|
||||||
simulcast.stream_label = "alice-simulcast";
|
simulcast.stream_label = "alice-svc";
|
||||||
// Because we have network with packets loss we can analyze only the
|
// Because we have network with packets loss we can analyze only the
|
||||||
// highest spatial layer in SVC mode.
|
// highest spatial layer in SVC mode.
|
||||||
simulcast.simulcast_config = VideoSimulcastConfig(3, 2);
|
simulcast.simulcast_config = VideoSimulcastConfig(3, 2);
|
||||||
|
|||||||
@ -629,8 +629,9 @@ void PeerConnectionE2EQualityTest::OnTrackCallback(
|
|||||||
std::vector<VideoConfig> remote_video_configs) {
|
std::vector<VideoConfig> remote_video_configs) {
|
||||||
const rtc::scoped_refptr<MediaStreamTrackInterface>& track =
|
const rtc::scoped_refptr<MediaStreamTrackInterface>& track =
|
||||||
transceiver->receiver()->track();
|
transceiver->receiver()->track();
|
||||||
RTC_CHECK_EQ(transceiver->receiver()->stream_ids().size(), 1);
|
RTC_CHECK_EQ(transceiver->receiver()->stream_ids().size(), 2)
|
||||||
std::string stream_label = transceiver->receiver()->stream_ids().front();
|
<< "Expected 2 stream ids: 1st - sync group, 2nd - unique stream label";
|
||||||
|
std::string stream_label = transceiver->receiver()->stream_ids()[1];
|
||||||
analyzer_helper_.AddTrackToStreamMapping(track->id(), stream_label);
|
analyzer_helper_.AddTrackToStreamMapping(track->id(), stream_label);
|
||||||
if (track->kind() != MediaStreamTrackInterface::kVideoKind) {
|
if (track->kind() != MediaStreamTrackInterface::kVideoKind) {
|
||||||
return;
|
return;
|
||||||
@ -770,8 +771,11 @@ PeerConnectionE2EQualityTest::MaybeAddVideo(TestPeer* peer) {
|
|||||||
video_config.screen_share_config->use_text_content_hint) {
|
video_config.screen_share_config->use_text_content_hint) {
|
||||||
track->set_content_hint(VideoTrackInterface::ContentHint::kText);
|
track->set_content_hint(VideoTrackInterface::ContentHint::kText);
|
||||||
}
|
}
|
||||||
|
std::string sync_group = video_config.sync_group
|
||||||
|
? video_config.sync_group.value()
|
||||||
|
: video_config.stream_label.value();
|
||||||
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> sender =
|
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> sender =
|
||||||
peer->AddTrack(track, {video_config.stream_label.value()});
|
peer->AddTrack(track, {sync_group, *video_config.stream_label});
|
||||||
RTC_CHECK(sender.ok());
|
RTC_CHECK(sender.ok());
|
||||||
if (video_config.temporal_layers_count) {
|
if (video_config.temporal_layers_count) {
|
||||||
RtpParameters rtp_parameters = sender.value()->GetParameters();
|
RtpParameters rtp_parameters = sender.value()->GetParameters();
|
||||||
@ -895,7 +899,10 @@ void PeerConnectionE2EQualityTest::MaybeAddAudio(TestPeer* peer) {
|
|||||||
peer->pc_factory()->CreateAudioSource(audio_config.audio_options);
|
peer->pc_factory()->CreateAudioSource(audio_config.audio_options);
|
||||||
rtc::scoped_refptr<AudioTrackInterface> track =
|
rtc::scoped_refptr<AudioTrackInterface> track =
|
||||||
peer->pc_factory()->CreateAudioTrack(*audio_config.stream_label, source);
|
peer->pc_factory()->CreateAudioTrack(*audio_config.stream_label, source);
|
||||||
peer->AddTrack(track, {*audio_config.stream_label});
|
std::string sync_group = audio_config.sync_group
|
||||||
|
? audio_config.sync_group.value()
|
||||||
|
: audio_config.stream_label.value();
|
||||||
|
peer->AddTrack(track, {sync_group, *audio_config.stream_label});
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnectionE2EQualityTest::SetPeerCodecPreferences(
|
void PeerConnectionE2EQualityTest::SetPeerCodecPreferences(
|
||||||
|
|||||||
@ -312,9 +312,10 @@ LocalAndRemoteSdp SignalingInterceptor::PatchVp9Offer(
|
|||||||
RTC_CHECK_EQ(content.media_description()->streams().size(), 1);
|
RTC_CHECK_EQ(content.media_description()->streams().size(), 1);
|
||||||
cricket::StreamParams& stream =
|
cricket::StreamParams& stream =
|
||||||
content.media_description()->mutable_streams()[0];
|
content.media_description()->mutable_streams()[0];
|
||||||
RTC_CHECK_EQ(stream.stream_ids().size(), 1)
|
RTC_CHECK_EQ(stream.stream_ids().size(), 2)
|
||||||
<< "Too many stream ids in video stream";
|
<< "Expected 2 stream ids in video stream: 1st - sync_group, 2nd - "
|
||||||
std::string stream_label = stream.stream_ids()[0];
|
"unique label";
|
||||||
|
std::string stream_label = stream.stream_ids()[1];
|
||||||
|
|
||||||
auto it =
|
auto it =
|
||||||
params_.stream_label_to_simulcast_streams_count.find(stream_label);
|
params_.stream_label_to_simulcast_streams_count.find(stream_label);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user