-
Notifications
You must be signed in to change notification settings - Fork 39
Additional RemoteTrackPublication options #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e5b763d
Initial implementation of additional remote track options
alan-george-lk ac64221
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk 7056ee0
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk 5f1b69a
Address all PR feedback
alan-george-lk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
src/tests/integration/test_remote_track_publication.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| /* | ||
| * Copyright 2026 LiveKit | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <chrono> | ||
| #include <cstdint> | ||
| #include <memory> | ||
| #include <string> | ||
| #include <thread> | ||
|
|
||
| #include "tests/common/test_common.h" | ||
|
|
||
| namespace livekit::test { | ||
|
|
||
| class RemoteTrackPublicationServerTest : public LiveKitTestBase {}; | ||
|
|
||
| TEST_F(RemoteTrackPublicationServerTest, PublicationControlsRoundTripAndDeduplicate) { | ||
| failIfNotConfigured(); | ||
|
|
||
| Room publisher_room; | ||
| Room subscriber_room; | ||
| const RoomOptions options; | ||
|
|
||
| ASSERT_TRUE(subscriber_room.connect(config_.url, config_.token_b, options)); | ||
| ASSERT_TRUE(publisher_room.connect(config_.url, config_.token_a, options)); | ||
|
|
||
| const std::string publisher_identity = lockLocalParticipant(publisher_room)->identity(); | ||
| ASSERT_TRUE(waitForParticipant(&subscriber_room, publisher_identity, 10s)); | ||
|
|
||
| constexpr std::uint32_t kSourceWidth = 640; | ||
| constexpr std::uint32_t kSourceHeight = 360; | ||
| constexpr std::uint32_t kRequestedWidth = 320; | ||
| constexpr std::uint32_t kRequestedHeight = 180; | ||
| const std::string track_name = "remote-dimension-update"; | ||
|
|
||
| auto source = std::make_shared<VideoSource>(kSourceWidth, kSourceHeight); | ||
| auto track = LocalVideoTrack::createLocalVideoTrack(track_name, source); | ||
| TrackPublishOptions publish_options; | ||
| publish_options.source = TrackSource::SOURCE_CAMERA; | ||
| publish_options.simulcast = true; | ||
| ASSERT_NO_THROW(lockLocalParticipant(publisher_room)->publishTrack(track, publish_options)); | ||
|
|
||
| std::shared_ptr<RemoteTrackPublication> publication; | ||
| const auto subscription_deadline = std::chrono::steady_clock::now() + 10s; | ||
| while (std::chrono::steady_clock::now() < subscription_deadline) { | ||
| auto publisher = subscriber_room.remoteParticipant(publisher_identity).lock(); | ||
| if (publisher != nullptr) { | ||
| for (const auto& [sid, candidate] : publisher->trackPublications()) { | ||
| (void)sid; | ||
| if (candidate != nullptr && candidate->name() == track_name && candidate->subscribed() && | ||
| candidate->track() != nullptr) { | ||
| publication = candidate; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| if (publication != nullptr) { | ||
| break; | ||
| } | ||
| std::this_thread::sleep_for(10ms); | ||
| } | ||
|
|
||
| ASSERT_NE(publication, nullptr) << "Timed out waiting for remote video subscription"; | ||
| ASSERT_EQ(publication->kind(), TrackKind::KIND_VIDEO); | ||
| ASSERT_TRUE(publication->simulcasted()); | ||
| EXPECT_EQ(publication->width(), kSourceWidth); | ||
| EXPECT_EQ(publication->height(), kSourceHeight); | ||
|
|
||
| EXPECT_TRUE(publication->setVideoDimensions(kRequestedWidth, kRequestedHeight)); | ||
| EXPECT_EQ(publication->width(), kSourceWidth); | ||
| EXPECT_EQ(publication->height(), kSourceHeight); | ||
| EXPECT_FALSE(publication->setVideoDimensions(kRequestedWidth, kRequestedHeight)); | ||
|
|
||
| EXPECT_FALSE(publication->setVideoQuality(static_cast<VideoQuality>(-1))); | ||
| EXPECT_TRUE(publication->setVideoQuality(VideoQuality::LOW)); | ||
| EXPECT_EQ(publication->videoQuality(), VideoQuality::LOW); | ||
| EXPECT_FALSE(publication->setVideoQuality(VideoQuality::LOW)); | ||
| EXPECT_TRUE(publication->setVideoDimensions(kRequestedWidth, kRequestedHeight)); | ||
| EXPECT_EQ(publication->videoQuality(), VideoQuality::HIGH); | ||
|
|
||
| EXPECT_TRUE(publication->setEnabled(false)); | ||
| EXPECT_FALSE(publication->enabled()); | ||
| EXPECT_FALSE(publication->setEnabled(false)); | ||
| EXPECT_TRUE(publication->setEnabled(true)); | ||
| EXPECT_TRUE(publication->enabled()); | ||
|
|
||
| EXPECT_FALSE(publication->setVideoDimensions(0, kRequestedHeight)); | ||
|
|
||
| publication->setSubscribed(false); | ||
| EXPECT_FALSE(publication->setVideoDimensions(kSourceWidth, kSourceHeight)); | ||
| EXPECT_FALSE(publication->setVideoQuality(VideoQuality::MEDIUM)); | ||
| EXPECT_FALSE(publication->setEnabled(false)); | ||
|
|
||
| if (track->publication() != nullptr) { | ||
| lockLocalParticipant(publisher_room)->unpublishTrack(track->publication()->sid()); | ||
| } | ||
| } | ||
|
|
||
| } // namespace livekit::test |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.