mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #1042, cover RTMP server response commands.
This commit is contained in:
parent
5516877867
commit
9c62a68e15
2 changed files with 83 additions and 1 deletions
|
@ -2698,7 +2698,7 @@ srs_error_t SrsRtmpServer::on_play_client_pause(int stream_id, bool is_pause)
|
|||
return srs_error_wrap(err, "send NetStream.Unpause.Notify");
|
||||
}
|
||||
}
|
||||
// StreanBegin
|
||||
// StreamBegin
|
||||
if (true) {
|
||||
SrsUserControlPacket* pkt = new SrsUserControlPacket();
|
||||
|
||||
|
|
|
@ -2048,3 +2048,85 @@ VOID TEST(ProtoStackTest, ServerRecursiveDepth)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(ProtoStackTest, ServerResponseCommands)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
// Start play.
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsRtmpServer r(&io);
|
||||
HELPER_EXPECT_SUCCESS(r.start_play(1));
|
||||
|
||||
if (true) {
|
||||
MockBufferIO tio;
|
||||
tio.in_buffer.append(&io.out_buffer);
|
||||
|
||||
SrsProtocol p(&tio);
|
||||
|
||||
SrsCommonMessage* msg = NULL;
|
||||
SrsCallPacket* pkt = NULL;
|
||||
|
||||
// onStatus(NetStream.Play.Reset)
|
||||
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
|
||||
srs_freep(msg);
|
||||
srs_freep(pkt);
|
||||
|
||||
// onStatus(NetStream.Play.Start)
|
||||
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
|
||||
srs_freep(msg);
|
||||
srs_freep(pkt);
|
||||
|
||||
// onStatus(NetStream.Data.Start)
|
||||
SrsPacket* bpkt = NULL;
|
||||
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &bpkt));
|
||||
srs_freep(msg);
|
||||
srs_freep(bpkt);
|
||||
}
|
||||
}
|
||||
|
||||
// Pause true.
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsRtmpServer r(&io);
|
||||
HELPER_EXPECT_SUCCESS(r.on_play_client_pause(1, true));
|
||||
|
||||
if (true) {
|
||||
MockBufferIO tio;
|
||||
tio.in_buffer.append(&io.out_buffer);
|
||||
|
||||
SrsProtocol p(&tio);
|
||||
|
||||
SrsCommonMessage* msg = NULL;
|
||||
SrsCallPacket* pkt = NULL;
|
||||
|
||||
// onStatus(NetStream.Pause.Notify)
|
||||
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
|
||||
srs_freep(msg);
|
||||
srs_freep(pkt);
|
||||
}
|
||||
}
|
||||
|
||||
// Pause false.
|
||||
if (true) {
|
||||
MockBufferIO io;
|
||||
SrsRtmpServer r(&io);
|
||||
HELPER_EXPECT_SUCCESS(r.on_play_client_pause(1, false));
|
||||
|
||||
if (true) {
|
||||
MockBufferIO tio;
|
||||
tio.in_buffer.append(&io.out_buffer);
|
||||
|
||||
SrsProtocol p(&tio);
|
||||
|
||||
SrsCommonMessage* msg = NULL;
|
||||
SrsCallPacket* pkt = NULL;
|
||||
|
||||
// onStatus(NetStream.Pause.Notify)
|
||||
HELPER_ASSERT_SUCCESS(p.expect_message(&msg, &pkt));
|
||||
srs_freep(msg);
|
||||
srs_freep(pkt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue