diff --git a/trunk/src/rtmp/srs_protocol_msg_array.hpp b/trunk/src/rtmp/srs_protocol_msg_array.hpp index 53057e089..4a2569391 100644 --- a/trunk/src/rtmp/srs_protocol_msg_array.hpp +++ b/trunk/src/rtmp/srs_protocol_msg_array.hpp @@ -50,7 +50,13 @@ public: SrsSharedPtrMessage** msgs; int size; public: + /** + * create msg array, initialize array to NULL ptrs. + */ SrsSharedPtrMessageArray(int _size); + /** + * free the msgs not sent out(not NULL). + */ virtual ~SrsSharedPtrMessageArray(); }; diff --git a/trunk/src/utest/srs_utest_protocol.cpp b/trunk/src/utest/srs_utest_protocol.cpp index 309eab196..18453fcff 100644 --- a/trunk/src/utest/srs_utest_protocol.cpp +++ b/trunk/src/utest/srs_utest_protocol.cpp @@ -413,5 +413,16 @@ VOID TEST(ProtocolMsgArrayTest, MessageArray) EXPECT_EQ(3, msg.count()); } EXPECT_EQ(0, msg.count()); + + if (true) { + SrsSharedPtrMessageArray arr(3); + + arr.msgs[0] = msg.copy(); + EXPECT_EQ(1, msg.count()); + + arr.msgs[2] = msg.copy(); + EXPECT_EQ(2, msg.count()); + } + EXPECT_EQ(0, msg.count()); }