Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit a9f3404

Browse files
taste1981Chunbo
authored andcommitted
Use track id for simulcast stream subscription.
1 parent 797b3d6 commit a9f3404

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

talk/owt/sdk/conference/conferenceclient.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,11 +1487,16 @@ void ConferenceClient::ParseStreamInfo(sio::message::ptr stream_info,
14871487
keyframe_interval_num;
14881488
}
14891489
}
1490-
auto rid_obj = (*tit)->get_map()["simulcastRid"];
1490+
auto rid_obj = (*tit)->get_map()["rid"];
14911491
if (rid_obj != nullptr &&
14921492
rid_obj->get_flag() == sio::message::flag_string) {
14931493
video_publication_settings.rid = rid_obj->get_string();
14941494
}
1495+
auto trackid_obj = (*tit)->get_map()["id"];
1496+
if (trackid_obj != nullptr &&
1497+
trackid_obj->get_flag() == sio::message::flag_string) {
1498+
video_publication_settings.track_id = trackid_obj->get_string();
1499+
}
14951500
publication_settings.video.push_back(video_publication_settings);
14961501
}
14971502
// Parse the video subscription capabilities.

talk/owt/sdk/conference/conferencepeerconnectionchannel.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,20 @@ void ConferencePeerConnectionChannel::Subscribe(
633633
} else {
634634
video_options->get_map()["mid"] = sio::string_message::create("1");
635635
}
636-
video_options->get_map()["from"] =
637-
sio::string_message::create(stream->Id());
636+
auto publication_settings = stream->Settings();
637+
if (subscribe_options.video.rid != "") {
638+
for (auto video_setting : publication_settings.video) {
639+
if (video_setting.rid == subscribe_options.video.rid) {
640+
std::string track_id = video_setting.track_id;
641+
video_options->get_map()["from"] =
642+
sio::string_message::create(track_id);
643+
break;
644+
}
645+
}
646+
} else {
647+
video_options->get_map()["from"] =
648+
sio::string_message::create(stream->Id());
649+
}
638650
sio::message::ptr video_spec = sio::object_message::create();
639651
sio::message::ptr resolution_options = sio::object_message::create();
640652
if (subscribe_options.video.resolution.width != 0 &&

talk/owt/sdk/include/cpp/owt/base/options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct VideoPublicationSettings {
3939
unsigned long bitrate;
4040
unsigned long keyframe_interval;
4141
std::string rid;
42+
std::string track_id;
4243
};
4344

4445
#ifdef OWT_ENABLE_QUIC

0 commit comments

Comments
 (0)