[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/rtmp r9603: add tests for decoding result
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/rtmp r9603: add tests for decoding result and onStatus messages. |
Date: |
Wed, 27 Aug 2008 19:21:29 -0600 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9603
committer: address@hidden
branch nick: rtmp
timestamp: Wed 2008-08-27 19:21:29 -0600
message:
add tests for decoding result and onStatus messages.
modified:
testsuite/libnet.all/test_rtmp.cpp
=== modified file 'testsuite/libnet.all/test_rtmp.cpp'
--- a/testsuite/libnet.all/test_rtmp.cpp 2008-08-26 22:47:52 +0000
+++ b/testsuite/libnet.all/test_rtmp.cpp 2008-08-28 01:21:29 +0000
@@ -69,6 +69,7 @@
static void test_results();
static void test_system();
static void test_client();
+static void test_split();
LogFile& dbglogfile = LogFile::getDefaultInstance();
@@ -176,6 +177,7 @@
test_system();
test_client();
test_results();
+ test_split();
// test_types();
#if defined(HAVE_MALLINFO) && defined(USE_STATS_MEMORY)
if (memdebug) {
@@ -184,7 +186,267 @@
#endif
}
-// 00 00 cf 03 04 c3 00 00
+void
+test_split()
+{
+ GNASH_REPORT_FUNCTION;
+
+ RTMPClient client;
+ bool notest = false;
+ RTMP::rtmp_head_t *rthead = 0;
+ CQue *que;
+
+ Buffer *buf1 = hex2mem("04 00 00 00 00 00 b8 14 01 00 00 00 02 00 08 6f 6e
53 74 61 74 75 73 00 00 00 00 00 00 00 00 00 05 03 00 05 6c 65 76 65 6c 02 00
06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e
50 6c 61 79 2e 52 65 73 65 74 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 2d
50 6c 61 79 69 6e 67 20 61 6e 64 20 72 65 73 65 74 74 69 6e 67 20 67 61 74 65
30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f 30 31 2e c4 00 07 64 65 74 61
69 6c 73 02 00 16 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f
30 31 00 08 63 6c 69 65 6e 74 69 64 00 41 bf e4 78 30 00 00 00 00 00 09");
+ RTMP::queues_t *queues1 = client.split(buf1, 128);
+ if (queues1->size() == 0) {
+ notest = true;
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(2 packets size)");
+ } else {
+ if (queues1->size() == 1) {
+ runtest.pass("RTMP::split(2 packets size)");
+ } else {
+ runtest.fail("RTMP::split(2 packets size)");
+ notest = true;
+ }
+ }
+ delete buf1;
+
+// Buffer *tmpbuf = que1.front();
+// que1.pop_front();
+ Buffer *tmpbuf = 0;
+ if (notest) {
+ runtest.untested("RTMP::split(1st packet header) of 2");
+ } else {
+ que = queues1->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues1->pop_front();
+ if (*tmpbuf->reference() == 0x4) {
+ runtest.pass("RTMP::split(1st packet header) of 2");
+ } else {
+ runtest.fail("RTMP::split(1st packet header) of 2" );
+ notest = true;
+ }
+ }
+#if 0
+// tmpbuf = client[4].pop();
+ if (notest) {
+ runtest.untested("RTMP::split(2nd packet header) of 2");
+ } else {
+ que = queues1->front();
+ cerr << "QUE1: " << que->getName() << " size is: " << que->size() <<
endl;
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+// queues1->pop_front();
+ if (*tmpbuf->reference() == 0xc4) {
+ runtest.pass("RTMP::split(2nd packet header) of 2");
+ } else {
+ runtest.fail("RTMP::split(2nd packet header) of 2");
+ notest = true;
+ }
+ }
+#endif
+ client[4].clear();
+// delete queues1;
+
+ Buffer *buf2 = hex2mem("02 00 00 00 00 00 04 01 00 00 00 00 00 00 00 80 02
00 00 00 00 00 06 04 00 00 00 00 00 04 00 00 00 01 04 00 00 00 00 00 b8 14 01
00 00 00 02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 00 00 00 00 05 03 00
05 6c 65 76 65 6c 02 00 06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e 65
74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 52 65 73 65 74 00 0b 64 65 73 63 72 69
70 74 69 6f 6e 02 00 2d 50 6c 61 79 69 6e 67 20 61 6e 64 20 72 65 73 65 74 74
69 6e 67 20 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f 30 31
2e 02 00 00 00 00 00 06 04 00 00 00 00 00 00 00 00 00 01 c4 00 07 64 65 74 61
69 6c 73 02 00 16 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f
30 31 00 08 63 6c 69 65 6e 74 69 64 00 41 d8 fb 78 56 00 00 00 00 00 09");
+ RTMP::queues_t *queues2 = client.split(buf2, 128);
+ if (queues2->size() == 0) {
+ notest = true;
+ }
+ if (notest) {
+ runtest.fail("RTMP::split(5 packets)");
+ } else {
+ // there are 4 pacjets in this message, 2 pings, followed by a
onStatus,
+ // followed by a ping, and then the rest of the onStatus message.
+ if (queues2->size() == 4) {
+ runtest.pass("RTMP::split(5 packets)");
+ notest = false;
+ } else {
+ runtest.fail("RTMP::split(5 packets)");
+ }
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(1st packet header of 5)");
+ } else {
+ que = queues2->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues2->pop_front();
+ if (*tmpbuf->reference() == 0x2) {
+ runtest.pass("RTMP::split(1st packet header) of 5");
+ } else {
+ runtest.fail("RTMP::split(1st packet header) of 5");
+ }
+ }
+ if (notest) {
+ runtest.untested("RTMP::split(2nd packet header) of 5");
+ } else {
+ que = queues2->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues2->pop_front();
+ if (*tmpbuf->reference() == 0x2) {
+ runtest.pass("RTMP::split(2nd packet header) of 5");
+ } else {
+ runtest.fail("RTMP::split(2nd packet header) of 5");
+ }
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(3rd packet header) of 5");
+ } else {
+ que = queues2->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues2->pop_front();
+ if (*tmpbuf->reference() == 0x04) {
+ runtest.pass("RTMP::split(3rd packet header) of 5");
+ } else {
+ runtest.fail("RTMP::split(3rd packet header) of 5");
+ }
+ }
+
+ queues2->pop_front();
+#if 0
+ if (notest) {
+ runtest.untested("RTMP::split(4th packet header) of 5");
+ } else {
+ que = queues2->front();
+ cerr << "QUE: " << que->getName() << " size is: " << que->size() <<
endl;
+ tmpbuf = que->pop();
+ queues2->pop_front();
+ if (*tmpbuf->reference() == 0x02) {
+ runtest.pass("RTMP::split(4th packet header) of 5");
+ } else {
+ runtest.fail("RTMP::split(4th packet header) of 5");
+ }
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(5th packet header) of 5");
+ } else {
+ que = queues2->front();
+ cerr << "QUE: " << que->getName() << " size is: " << que->size() <<
endl;
+ tmpbuf = que->pop();
+ queues2->pop_front();
+ if (*tmpbuf->reference() == 0x04) {
+ runtest.pass("RTMP::split(5th packet header) of 5");
+ } else {
+ runtest.fail("RTMP::split(5th packet header) of 5");
+ }
+ }
+#endif
+ delete buf2;
+// delete queues2;
+
+ // Try a much more complex packet, similar to the previous one, but with
more intermixed packets
+ // for other channels.
+//
...............onStatus.............level...status..code...NetStream.Play.Start..description..'Started
playing
gate06_tablan_bcueu_01...clie......'address@hidden;...../..rP.....K.......m......,......%......................B........M.<.$.....`.......i..9..C..J..........%..........G....2Np."address@hidden;.ntid.A..xV.....
+ Buffer *buf3 = hex2mem("05 00 00 00 00 00 90 14 01 00 00 00 02 00 08 6f 6e
53 74 61 74 75 73 00 00 00 00 00 00 00 00 00 05 03 00 05 6c 65 76 65 6c 02 00
06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e
50 6c 61 79 2e 53 74 61 72 74 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 27
53 74 61 72 74 65 64 20 70 6c 61 79 69 6e 67 20 67 61 74 65 30 36 5f 74 61 62
6c 61 6e 5f 62 63 75 65 75 5f 30 31 2e 00 08 63 6c 69 65 07 00 00 00 00 00 27
09 01 00 00 00 14 00 78 46 0f 14 0f 14 3f 6a ff ff 00 08 9f 40 10 9f f8 8b 3f
fd b2 4f fb 5d c0 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 08
01 00 00 00 08 00 00 00 00 01 3b 08 01 00 00 00 2f ff fb 72 50 00 00 00 00 00
4b 00 00 00 00 07 e0 09 6d 00 00 00 00 00 01 2c 00 00 00 00 1f 80 25 b4 00 00
00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff fc 0c 87 42 80 ec c8 b0 0e 90
c2 12 4d 90 3c 18 24 16 01 88 03 e1 60 1a 1a a0 1a 09 9c 1a 69 a1 10 39 06 8d
43 02 c3 4a 12 0b 00 c8 1f 0b 00 d8 16 00 25 9f ff ff fe c1 a0 00 00 ff 8a 47
80 80 0e 1e 32 4e 70 f1 22 ed 31 60 40 f8 02 00 00 00 00 00 04 01 00 00 00 00
00 00 01 3b c5 6e 74 69 64 00 41 d8 fb 78 56 00 00 00 00 00 09");
+ RTMP::queues_t *queues3 = client.split(buf3, 128);
+ if (queues3->size() == 0) {
+ notest = true;
+ }
+ if (notest) {
+ runtest.fail("RTMP::split(corrupted packets)");
+ } else {
+ if (queues3->size() == 5) {
+ runtest.pass("RTMP::split(6 complex packets)");
+ notest = false;
+ } else {
+ runtest.fail("RTMP::split(6 complex packets)");
+ }
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(1st packet header) of 6");
+ } else {
+ que = queues3->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues3->pop_front();
+ rthead = client.decodeHeader(tmpbuf);
+ if ((*tmpbuf->reference() == 0x05) && (rthead->type <= RTMP::INVOKE))
{
+ runtest.pass("RTMP::split(1st packet header) of 6");
+ } else {
+ runtest.fail("RTMP::split(1st packet header) of 6");
+ }
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(2nd packet header) of 6");
+ } else {
+ que = queues3->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues3->pop_front();
+ rthead = client.decodeHeader(tmpbuf);
+ if ((*tmpbuf->reference() == 0x07) && (rthead->type <=
RTMP::VIDEO_DATA)) {
+ runtest.pass("RTMP::split(2nd packet header) of 6");
+ } else {
+ runtest.fail("RTMP::split(2nd packet header) of 6");
+ }
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(3rd packet header) of 6");
+ } else {
+ que = queues3->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues3->pop_front();
+ rthead = client.decodeHeader(tmpbuf);
+ if ((*tmpbuf->reference() == 0x08) && (rthead->type <=
RTMP::AUDIO_DATA)) {
+ runtest.pass("RTMP::split(3rd packet header) of 6");
+ } else {
+ runtest.fail("RTMP::split(3rd packet header) of 6");
+ }
+ }
+
+ if (notest) {
+ runtest.untested("RTMP::split(4th packet header) of 6");
+ } else {
+ que = queues3->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues3->pop_front();
+ rthead = client.decodeHeader(tmpbuf);
+ if ((*tmpbuf->reference() == 0x08) && (rthead->type <=
RTMP::AUDIO_DATA)) {
+ runtest.pass("RTMP::split(4th packet header) of 6");
+ } else {
+ runtest.fail("RTMP::split(4th packet header) of 6");
+ }
+ }
+ if (notest) {
+ runtest.untested("RTMP::split(5th packet header) of 6");
+ } else {
+ que = queues3->front();
+ tmpbuf = que->pop();
+// tmpbuf->dump();
+ queues3->pop_front();
+
+ rthead = client.decodeHeader(tmpbuf);
+ if ((*tmpbuf->reference() == 0x02) && (rthead->type <=
RTMP::AUDIO_DATA)) {
+ runtest.pass("RTMP::split(5th packet header) of 6");
+ } else {
+ runtest.fail("RTMP::split(5th packet header) of 6");
+ }
+ }
+
+ delete buf3;
+// delete queues3;
+
+// delete que1;
+
+// delete buf2;
+// delete que2;
+}
+
void
test_system()
{
@@ -214,6 +476,7 @@
boost::uint32_t time = *(reinterpret_cast<boost::uint32_t
*>(buf2->reference() + 2));
Buffer *enc2 = server.encodePing(RTMP::PING_CLIENT, htonl(time));
+// cerr << hexify(enc2->begin(), enc2->size(), false) << endl;
if ((memcmp(buf2->reference(), enc2->reference(), 6) == 0)) {
runtest.pass("Encoded RTMP Ping Client message");
} else {
@@ -229,6 +492,16 @@
runtest.fail("Decoded RTMP Ping Client message");
}
+ // SERVER message
+// Buffer *hex1 = hex2mem("02 00 00 00 00 00 04 05 00 00 00 00 00 13 12
d0");
+// Buffer *hex1 = hex2mem("00 13 12 d0");
+// RTMPMsg *msg1 = client.decodeMsgBody(hex1);
+
+ // Client message
+// Buffer *hex2 = hex2mem("02 00 00 00 00 00 05 06 00 00 00 00 00 13 12 d0
02");
+// Buffer *hex2 = hex2mem("00 13 12 d0 02");
+// RTMPMsg *msg2 = client.decodeMsgBody(hex2);
+
#if 0
for (double dub=0; dub<=200; dub ++) {
Element el11;
@@ -264,6 +537,7 @@
Buffer *buf1 = hex2mem("03 00 00 00 00 01 1f 14 00 00 00 00");
Buffer *head1 = server.encodeHeader(0x3, RTMP::HEADER_12, 287,
RTMP::INVOKE, RTMPMsg::FROM_SERVER);
+// cerr << hexify(head1->begin(), RTMP_MAX_HEADER_SIZE, false) << endl;
if ((memcmp(buf1->reference(), head1->reference(), RTMP_MAX_HEADER_SIZE)
== 0)) {
runtest.pass("Encoded RTMP header(Invoke)");
@@ -282,6 +556,7 @@
Buffer *buf2 = hex2mem("02 00 00 00 00 00 06 04 00 00 00 00");
Buffer *head2 = server.encodeHeader(0x2, RTMP::HEADER_12, PING_MSG_SIZE,
RTMP::PING, RTMPMsg::FROM_SERVER);
+// cerr << hexify(head2->begin(), RTMP_MAX_HEADER_SIZE, false) << endl;
if ((memcmp(buf2->reference(), head2->reference(), 8) == 0)) {
runtest.pass("Encoded RTMP header(Ping 0)");
} else {
@@ -314,12 +589,38 @@
} else {
runtest.fail("Encoded RTMP header(size 1)");
}
+
+// 43 00 00 00 00 00 15 14 02 00 08 6f 6e 42 57 44 onBWDone
+// 6f 6e 65 00 40 00 00 00 00 00 00 00 05
+
+ Buffer *buf5 = hex2mem("43 00 00 00 00 00 19 14");
+ Buffer *head5 = server.encodeHeader(0x3, RTMP::HEADER_8, 0x19,
RTMP::INVOKE,
+ RTMPMsg::FROM_CLIENT);
+// head5->dump();
+// cerr << hexify(head5->begin(), 8, false) << endl;
+ if ((memcmp(buf5->reference(), head5->reference(), 8) == 0)) {
+ runtest.pass("Encoded RTMP header(size 8)");
+ } else {
+ runtest.fail("Encoded RTMP header(size 8)");
+ }
+ delete head5;
+
+ RTMP::rtmp_head_t *header3 = client.decodeHeader(buf5);
+ if ((header3->channel == 0x3) && (header3->head_size == 8)
+ && (header3->bodysize == 0x19) && (header3->type == RTMP::INVOKE)) {
+ runtest.pass("Decoded RTMP header(size 8)");
+ } else {
+ runtest.fail("Decoded RTMP header(size 8)");
+ }
+
// cleanup after ourselves
delete buf1;
delete buf2;
delete buf3;
delete buf4;
+ delete buf5;
+
delete head1;
delete head2;
delete head3;
@@ -332,7 +633,7 @@
test_results()
{
GNASH_REPORT_FUNCTION;
- RTMPServer rtmpserv;
+ RTMPClient rtmp;
// 03 00 00 00 00 00 81 14 00 00 00 00 02 00 07 5f ..............._
// 72 65 73 75 6c 74 00 3f f0 00 00 00 00 00 00 05 result.?........
// 03 00 0b 61 70 70 6c 69 63 61 74 69 6f 6e 05 00 ...application..
@@ -344,12 +645,13 @@
// 63 74 2e 53 75 63 63 65 73 73 00 00 c3 09 ct.Success....
Buffer *hex2 = hex2mem("02 00 07 5f 72 65 73 75 6c 74 00 3f f0 00 00 00 00
00 00 05 03 00 0b 61 70 70 6c 69 63 61 74 69 6f 6e 05 00 05 6c 65 76 65 6c 02
00 06 73 74 61 74 75 73 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 15 43 6f
6e 6e 65 63 74 69 6f 6e 20 73 75 63 63 65 65 64 65 64 2e 00 04 63 6f 64 65 02
00 1d 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63 74 2e 53 75
63 63 65 73 73 00 00 09");
- RTMPMsg *msg1 = rtmpserv.decodeMsgBody(hex2);
+ RTMPMsg *msg1 = rtmp.decodeMsgBody(hex2);
if (msg1) {
std::vector<amf::Element *> hell = msg1->getElements();
std::vector<amf::Element *> props = hell[0]->getProperties();
// printf("FIXME: %d, %d, %s:%s\n", props.size(), msg1->getStatus(),
// props[3]->getName(), props[3]->to_string());
+// msg1->dump();
// msg1->dump();
if ((msg1->getStatus() == RTMPMsg::NC_CONNECT_SUCCESS)
&& (msg1->getMethodName() == "_result")
@@ -364,6 +666,8 @@
}
delete msg1;
+#if 0
+ RTMPServer rtmpserv;
Buffer *buf2 = rtmpserv.encodeResult(RTMPMsg::NC_CONNECT_SUCCESS);
// cerr << hexify(buf2->begin(), 122, true) << endl;
if ((memcmp(hex2->reference(), buf2->reference(), 122) == 0)) {
@@ -373,9 +677,10 @@
}
delete buf2;
delete hex2;
+#endif
Buffer *hex3 = hex2mem("02 00 07 5f 72 65 73 75 6c 74 00 3f f0 00 00 00 00
00 00 05 03 00 0b 61 70 70 6c 69 63 61 74 69 6f 6e 05 00 05 6c 65 76 65 6c 02
00 05 65 72 72 6f 72 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 00 00 04 63
6f 64 65 02 00 1c 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63
74 2e 46 61 69 6c 65 64 00 00 09");
- RTMPMsg *msg2 = rtmpserv.decodeMsgBody(hex3);
+ RTMPMsg *msg2 = rtmp.decodeMsgBody(hex3);
std::vector<amf::Element *> hell = msg2->getElements();
std::vector<amf::Element *> props = hell[0]->getProperties();
// printf("FIXME: %d, %d, %s:%s\n", props.size(), msg1->getStatus(),
@@ -406,49 +711,120 @@
// }
// delete buf4;
-
-#if 0
-// const char *x4 = "";
- Buffer *hex4 = hex2mem("");
- Buffer *buf4 = rtmpserv.encodeResult(RTMPMsg::NC_CONNECT_REJECTED);
- if ((memcmp(hex4->reference(), buf4->reference(), buf4->size()) == 0)) {
- runtest.pass("Encoded RTMP result(NC_CONNECT_REJECTED");
- } else {
- runtest.fail("Encoded RTMP result(NC_CONNECT_REJECTED)");
- }
- delete buf4;
-
-// const char *x5 = "";
- Buffer *hex5 = hex2mem("");
- Buffer *buf5 = rtmpserv.encodeResult(RTMPMsg::NC_CONNECT_APPSHUTDOWN);
- if ((memcmp(hex5->reference(), buf5->reference(), buf5->size()) == 0)) {
- runtest.pass("Encoded RTMP result(NC_CONNECT_APPSHUTDOWN)");
- } else {
- runtest.fail("Encoded RTMP result(NC_CONNECT_APPSHUTDOWN)");
- }
- delete buf5;
-
-// const char *x6 = "";
- Buffer *hex6 = hex2mem("");
- Buffer *buf6 =
rtmpserv.encodeResult(RTMPMsg::NC_CONNECT_INVALID_APPLICATION);
- if ((memcmp(hex6->reference(), buf6->reference(), buf6->size()) == 0)) {
- runtest.pass("Encoded RTMP result(NC_CONNECT_INVALID_APPLICATION)");
- } else {
- runtest.fail("Encoded RTMP result(NC_CONNECT_INVALID_APPLICATION)");
- }
- delete buf6;
-
-// const char *x7 = "";
- Buffer *hex7 = hex2mem("");
- Buffer *buf7 = rtmpserv.encodeResult(RTMPMsg::NC_CONNECT_CLOSED);
- if ((memcmp(hex7->reference(), buf7->reference(), buf7->size()) == 0)) {
- runtest.pass("Encoded RTMP result(NC_CONNECT_INVALID_CLOSED)");
- } else {
- runtest.fail("Encoded RTMP result(NC_CONNECT_INVALID_CLOSED)");
- }
- delete buf7;
-#endif
-
+// onStatus
+// level
+// status
+// code
+// NetStream.Play.Reset
+// description
+// Playing and resetting address@hidden
+// details
+// address@hidden
+// clientid
+// dsLgYohb
+ Buffer *hex4 = hex2mem("02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 00
00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 06 73 74 61 74 75 73 00 04 63 6f 64
65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 52 65 73 65 74 00 0b
64 65 73 63 72 69 70 74 69 6f 6e 02 00 2a 50 6c 61 79 69 6e 67 20 61 6e 64 20
72 65 73 65 74 74 69 6e 67 20 50 44 5f 45 6e 67 6c 69 73 68 5f 4c 6f 77 40 32
30 30 31 2e 00 07 64 65 74 61 69 6c 73 02 00 13 50 44 5f 45 6e 67 6c 69 73 68
5f 4c 6f 77 40 32 30 30 31 00 08 63 6c 69 65 6e 74 69 64 02 00 08 64 73 4c 67
59 6f 68 62 00 00 09");
+ RTMPMsg *msg4 = rtmp.decodeMsgBody(hex4);
+// msg4->dump();
+// std::vector<amf::Element *> hell4 = msg4->getElements();
+ if ((msg4->getStatus() == RTMPMsg::NS_PLAY_RESET)
+ && (msg4->getMethodName() == "onStatus")
+ && (msg4->getStreamID() == 0)
+ && (msg4->size() == 1)) {
+ runtest.pass("Encoded/Decoded RTMP onStatus(Play Reset)");
+ } else {
+ runtest.fail("Encoded/Decoded RTMP onStatus(Play Reset)");
+ }
+ delete hex4;
+ delete msg4;
+
+// onStatus
+// code
+// NetStream
+// Data.Start
+ Buffer *hex5 = hex2mem("02 00 08 6f 6e 53 74 61 74 75 73 03 00 04 63
6f 64 65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e 44 61 74 61 2e 53 74 61 72 74
00 00 09");
+ RTMPMsg *msg5 = rtmp.decodeMsgBody(hex5);
+// msg5->dump();
+// cout << msg5->getStreamID() << endl;
+// std::vector<amf::Element *> hell4 = msg4->getElements();
+ if ((msg5->getStatus() == RTMPMsg::NS_DATA_START)
+ && (msg5->getMethodName() == "onStatus")
+ && (msg5->getStreamID() == -1)
+ && (msg5->size() == 1)) {
+ runtest.pass("Encoded/Decoded RTMP onStatus(Data Start)");
+ } else {
+ runtest.fail("Encoded/Decoded RTMP onStatus(Data Start)");
+ }
+ delete hex5;
+ delete msg5;
+
+// onStatus
+// level
+// status
+// code
+// NetStream.Play.Start
+// description
+// Started playing address@hidden
+// details
+// address@hidden
+ Buffer *hex6 = hex2mem("02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 00
00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 06 73 74 61 74 75 73 00 04 63 6f 64
65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 53 74 61 72 74 00 0b
64 65 73 63 72 69 70 74 69 6f 6e 02 00 24 53 74 61 72 74 65 64 20 70 6c 61 79
69 6e 67 20 50 44 5f 45 6e 67 6c 69 73 68 5f 4c 6f 77 40 32 30 30 31 2e 00 07
64 65 74 61 69 6c 73 02 00 13 50 44 5f 45 6e 67 6c 69 73 68 5f 4c 6f 77 40 32
30 30 31 00 08 63 6c 69 65 6e 74 69 64 02 00 08 64 73 4c 67 59 6f 68 62 00 00
09");
+ RTMPMsg *msg6 = rtmp.decodeMsgBody(hex6);
+// msg6->dump();
+// std::vector<amf::Element *> hell4 = msg4->getElements();
+ if ((msg6->getStatus() == RTMPMsg::NS_PLAY_START)
+ && (msg6->getMethodName() == "onStatus")
+ && (msg6->getStreamID() == 0)
+ && (msg6->size() == 1)) {
+ runtest.pass("Encoded/Decoded RTMP onStatus(Play Start)");
+ } else {
+ runtest.fail("Encoded/Decoded RTMP onStatus(Play Start)");
+ }
+ delete hex6;
+ delete msg6;
+
+// ..............._error.?.........
..level...error..code...NetConnection.Connect.Rejected..description..A[
Server.Reject ] : Virtual host _defa.ultVHost_ is not available....
+ Buffer *hex7 = hex2mem("02 00 06 5f 65 72 72 6f 72 00 3f f0 00 00 00 00 00
00 05 03 00 05 6c 65 76 65 6c 02 00 05 65 72 72 6f 72 00 04 63 6f 64 65 02 00
1e 4e 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63 74 2e 52 65 6a
65 63 74 65 64 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 41 5b 20 53 65 72
76 65 72 2e 52 65 6a 65 63 74 20 5d 20 3a 20 56 69 72 74 75 61 6c 20 68 6f 73
74 20 5f 64 65 66 61 c3 75 6c 74 56 48 6f 73 74 5f 20 69 73 20 6e 6f 74 20 61
76 61 69 6c 61 62 6c 65 2e 00 00 09");
+ RTMPMsg *msg7 = rtmp.decodeMsgBody(hex7);
+ if ((msg7->getStatus() == RTMPMsg::NC_CONNECT_REJECTED)
+ && (msg7->getMethodName() == "_error")
+ && (msg7->size() == 1)) {
+ runtest.pass("Decoded RTMP _error(NC_CONNECT_REJECTED");
+ } else {
+ runtest.fail("Decoded RTMP _error(NC_CONNECT_REJECTED)");
+ }
+
+ delete hex7;
+ delete msg7;
+
+//.onStatus.............level...error..code...NetStream.Play.StreamNotFound..description..6Failed
to play gate06_tablan_bcueu_; .stream not
found...details...gate06_tablan_bcueu_..clientid.A.;..
+ Buffer *hex8 = hex2mem("02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 00
00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 05 65 72 72 6f 72 00 04 63 6f 64 65
02 00 1d 4e 65 74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 53 74 72 65 61 6d 4e 6f
74 46 6f 75 6e 64 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 36 46 61 69 6c
65 64 20 74 6f 20 70 6c 61 79 20 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62
63 75 65 75 5f 3b 20 c4 73 74 72 65 61 6d 20 6e 6f 74 20 66 6f 75 6e 64 2e 00
07 64 65 74 61 69 6c 73 02 00 14 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62
63 75 65 75 5f 00 08 63 6c 69 65 6e 74 69 64 00 41 d8 3b b4 e4 00 00 00 00 00
09");
+ RTMPMsg *msg8 = rtmp.decodeMsgBody(hex8);
+// msg4->dump();
+// std::vector<amf::Element *> hell4 = msg4->getElements();
+ if ((msg8->getStatus() == RTMPMsg::NS_PLAY_STREAMNOTFOUND)
+ && (msg8->getMethodName() == "onStatus")
+ && (msg8->size() == 1)) {
+ runtest.pass("Encoded/Decoded RTMP onStatus(Play Stream Not Found)");
+ } else {
+ runtest.fail("Encoded/Decoded RTMP onStatus(Play Stream Not Found)");
+ }
+ delete hex8;
+ delete msg8;
+
+
+//.....onStatus.............level...status..code...NetStream.Play.Stop..description..%Stopped
playing
gate06_tablan_bcueu_...details....gate06_tablan_bcueu_..clientid.A.;.......reason......
+ Buffer *hex9 = hex2mem("02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 00
00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 06 73 74 61 74 75 73 00 04 63 6f 64
65 02 00 13 4e 65 74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 53 74 6f 70 00 0b 64
65 73 63 72 69 70 74 69 6f 6e 02 00 25 53 74 6f 70 70 65 64 20 70 6c 61 79 69
6e 67 20 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f 2e 00 07
64 65 74 61 69 6c 73 c4 02 00 14 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62
63 75 65 75 5f 00 08 63 6c 69 65 6e 74 69 64 00 41 d8 3b b4 e4 00 00 00 00 06
72 65 61 73 6f 6e 02 00 00 00 00 09");
+ RTMPMsg *msg9 = rtmp.decodeMsgBody(hex9);
+// msg4->dump();
+// std::vector<amf::Element *> hell4 = msg4->getElements();
+ if ((msg9->getStatus() == RTMPMsg::NS_PLAY_STOP)
+ && (msg9->getMethodName() == "onStatus")
+ && (msg9->size() == 1)) {
+ runtest.pass("Encoded/Decoded RTMP onStatus(Play Stream Stop)");
+ } else {
+ runtest.fail("Encoded/Decoded RTMP onStatus(Play Stream Stop)");
+ }
+ delete hex9;
+ delete msg9;
}
void
@@ -481,8 +857,8 @@
delete buf1;
delete buf2;
- buf1 = hex2mem("02 00 04 70 6c 61 79 00 00 00 00 00 00 00 00 00 05 01 00");
- buf2 = rtmp.encodeStreamOp(0, RTMP::STREAM_PLAY, false);
+ buf1 = hex2mem("02 00 04 70 6c 61 79 00 00 00 00 00 00 00 00 00 05 02 00
16 67 61 74 65 30 36 5f 74 61 62 6c 616e 5f 62 63 75 65 75 5f 30 31");
+ buf2 = rtmp.encodeStreamOp(0, RTMP::STREAM_PLAY, false,
"gate06_tablan_bcueu_01");
if ((memcmp(buf1->reference(), buf2->reference(), buf1->size()) == 0)) {
runtest.pass("Encoded RTMPClient::encodeStreamOp(RTMP::STREAM_PLAY)");
} else {
@@ -544,9 +920,24 @@
}
delete buf1;
delete buf2;
-
}
+// FLV data header
+//
+// onMetaData
+// duration
+// width
+// height
+// videodatarate
+// framerate
+// videocodecid
+// audiodatarate
+// audiodelay
+// audiocodecid
+// canSeek
+// ToEnd
+//"02 00 0a 6 6e 4d 65 74 61 44 61 74 61 08 00 00 00 0a 00 08 64 75 72 61 74
69 6f 6e 00 40 ad 04 14 7a e1 47 ae 00 05 77 69 64 74 68 00 40 74 00 00 00 00
00 00 00 06 68 65 69 67 68 74 00 40 6e 00 00 00 00 00 00 0d 76 69 64 65 6f 64
61 74 61 72 61 74 65 00 40 72 c0 00 00 00 00 00 00 09 66 72 61 6d 65 72 61 74
65 00 40 39 00 00 00 00 00 00 00 0c 76 69 64 65 6f 63 6f 64 65 63 69 64 00 40
10 00 00 00 00 00 00 00 0d 61 75 64 69 6f 64 61 74 61 72 61 74 65 00 40 58 00
00 00 00 00 00 00 0a 61 75 64 69 6f 64 65 6c 61 79 00 3f a3 74 bc 6a 7e f9 db
00 0c 61 75 64 69 6f 63 6f 64 65 63 69 64 00 40 00 00 00 00 00 00 00 00 0c 63
61 6e 53 65 65 6b 54 6f 45 6e 64 01 01 00 00 09"
+
static void
usage (void)
{
@@ -560,7 +951,7 @@
#else
int
-main(int /* argc */, char /* *argv[] */ )
+main(int /*argc*/, char /* *argv[]*/)
{
// nop
return 0;
@@ -568,24 +959,22 @@
#endif
-// 03 00 00 04 00 01 1f 14 00 00 00 00 02 00 07 63 ...............c
-// 6f 6e 6e 65 63 74 00 3f f0 00 00 00 00 00 00 03 onnect.?........
-// 00 03 61 70 70 02 00 08 6f 66 6c 61 44 65 6d 6f ..app...oflaDemo
-// 00 08 66 6c 61 73 68 56 65 72 02 00 0c 4c 4e 58 ..flashVer...LNX
-// 20 39 2c 30 2c 33 31 2c 30 00 06 73 77 66 55 72 9,0,31,0..swfUr
-// 6c 02 00 33 68 74 74 70 3a 2f 2f 6c 6f 63 61 6c l..3http://local
-// 68 6f 73 74 2f 73 6f 66 74 77 61 72 65 2f 67 6e host/software/gn
-// 61 73 68 2f 74 65 73 74 73 2f 6f 66 6c 61 5f 64 ash/tests/ofla_d
-// 65 6d 6f 2e 73 77 66 00 05 74 63 55 c3 72 6c 02 emo.swf..tcU.rl.
-// 00 19 72 74 6d 70 3a 2f 2f 6c 6f 63 61 6c 68 6f ..rtmp://localho
-// 73 74 2f 6f 66 6c 61 44 65 6d 6f 00 04 66 70 61 st/oflaDemo..fpa
-// 64 01 00 00 0b 61 75 64 69 6f 43 6f 64 65 63 73 d....audioCodecs
-// 00 40 83 38 00 00 00 00 00 00 0b 76 69 64 65 6f address@hidden
-// 43 6f 64 65 63 73 00 40 5f 00 00 00 00 00 00 00 address@hidden
-// 0d 76 69 64 65 6f 46 75 6e 63 74 69 6f 6e 00 3f .videoFunction.?
-// f0 00 00 00 00 00 00 00 07 70 61 67 65 55 72 6c .........pageUrl
-// 02 00 26 68 74 74 70 3a 2f 2f 6c 6f 63 c3 61 6c ..&http://loc.al
-// 68 6f 73 74 2f 73 6f 66 74 77 61 72 65 2f 67 6e host/software/gn
-// 61 73 68 2f 74 65 73 74 73 2f 00 00 09
-
+// T 193.2.4.161:1935 -> 192.168.1.103:34693 [AP]
+// 03 00 00 00 00 00 9e 14 00 00 00 00 02 00 06 5f ..............._
+// 65 72 72 6f 72 00 3f f0 00 00 00 00 00 00 05 03 error.?.........
+// 00 05 6c 65 76 65 6c 02 00 05 65 72 72 6f 72 00 ..level...error.
+// 04 63 6f 64 65 02 00 1e 4e 65 74 43 6f 6e 6e 65 .code...NetConne
+// 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63 74 2e 52 65 ction.Connect.Re
+// 6a 65 63 74 65 64 00 0b 64 65 73 63 72 69 70 74 jected..descript
+// 69 6f 6e 02 00 41 5b 20 53 65 72 76 65 72 2e 52 ion..A[ Server.R
+// 65 6a 65 63 74 20 5d 20 3a 20 56 69 72 74 75 61 eject ] : Virtua
+// 6c 20 68 6f 73 74 20 5f 64 65 66 61 c3 75 6c 74 l host _defa.ult
+// 56 48 6f 73 74 5f 20 69 73 20 6e 6f 74 20 61 76 VHost_ is not av
+// 61 69 6c 61 62 6c 65 2e 00 00 09 ailable....
+// #
+
+// T 193.2.4.161:1935 -> 192.168.1.103:34693 [AP]
+// 03 00 00 00 00 00 12 14 00 00 00 00 02 00 05 63 ...............c
+// 6c 6f 73 65 00 00 00 00 00 00 00 00 00 05 lose..........
+// #
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/rtmp r9603: add tests for decoding result and onStatus messages.,
rob <=