mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Cover default track status
This commit is contained in:
parent
0eae1bd493
commit
c72fb76334
1 changed files with 34 additions and 0 deletions
|
@ -26,6 +26,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <srs_core_autofree.hpp>
|
#include <srs_core_autofree.hpp>
|
||||||
#include <srs_app_rtc_queue.hpp>
|
#include <srs_app_rtc_queue.hpp>
|
||||||
#include <srs_kernel_rtc_rtp.hpp>
|
#include <srs_kernel_rtc_rtp.hpp>
|
||||||
|
#include <srs_app_rtc_source.hpp>
|
||||||
|
#include <srs_app_rtc_conn.hpp>
|
||||||
|
|
||||||
VOID TEST(KernelRTCTest, SequenceCompare)
|
VOID TEST(KernelRTCTest, SequenceCompare)
|
||||||
{
|
{
|
||||||
|
@ -123,3 +125,35 @@ VOID TEST(KernelRTCTest, SequenceCompare)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID TEST(KernelRTCTest, DefaultTrackStatus)
|
||||||
|
{
|
||||||
|
// By default, track is disabled.
|
||||||
|
if (true) {
|
||||||
|
SrsRtcTrackDescription td;
|
||||||
|
|
||||||
|
// The track must default to disable, that is, the active is false.
|
||||||
|
EXPECT_FALSE(td.is_active_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable it by player or connection.
|
||||||
|
if (true) {
|
||||||
|
SrsRtcConnection s(NULL, SrsContextId()); SrsRtcPlayStream play(&s, SrsContextId());
|
||||||
|
SrsRtcAudioSendTrack* audio; SrsRtcVideoSendTrack *video;
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
SrsRtcTrackDescription ds; ds.type_ = "audio"; ds.id_ = "NSNWOn19NDn12o8nNeji2"; ds.ssrc_ = 100;
|
||||||
|
play.audio_tracks_[ds.ssrc_] = audio = new SrsRtcAudioSendTrack(&s, &ds);
|
||||||
|
}
|
||||||
|
if (true) {
|
||||||
|
SrsRtcTrackDescription ds; ds.type_ = "video"; ds.id_ = "VMo22nfLDn122nfnDNL2"; ds.ssrc_ = 200;
|
||||||
|
play.video_tracks_[ds.ssrc_] = video = new SrsRtcVideoSendTrack(&s, &ds);
|
||||||
|
}
|
||||||
|
EXPECT_FALSE(audio->get_track_status());
|
||||||
|
EXPECT_FALSE(video->get_track_status());
|
||||||
|
|
||||||
|
play.set_track_status(true);
|
||||||
|
EXPECT_TRUE(audio->get_track_status());
|
||||||
|
EXPECT_TRUE(video->get_track_status());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue