winlin

add comments. refine naming

@@ -28,7 +28,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -28,7 +28,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include <srs_core.hpp> 28 #include <srs_core.hpp>
29 */ 29 */
30 30
31 -// user must include the srs_core.hpp before any header. 31 +/**
  32 +* the core provides the common defined macros, utilities,
  33 +* user must include the srs_core.hpp before any header, or maybe
  34 +* build failed.
  35 +*/
32 36
33 // for int64_t print using PRId64 format. 37 // for int64_t print using PRId64 format.
34 #ifndef __STDC_FORMAT_MACROS 38 #ifndef __STDC_FORMAT_MACROS
@@ -36,6 +40,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -36,6 +40,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 #endif 40 #endif
37 41
38 #include <assert.h> 42 #include <assert.h>
39 -#define SrsAssert(expression) assert(expression) 43 +#define srs_assert(expression) assert(expression)
40 44
41 #endif 45 #endif
@@ -36,10 +36,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -36,10 +36,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 * auto free the instance in the current scope. 36 * auto free the instance in the current scope.
37 */ 37 */
38 #define SrsAutoFree(className, instance, is_array) \ 38 #define SrsAutoFree(className, instance, is_array) \
39 - c__SrsAutoFree<className> _auto_free_##instance(&instance, is_array) 39 + __SrsAutoFree<className> _auto_free_##instance(&instance, is_array)
40 40
41 template<class T> 41 template<class T>
42 -class c__SrsAutoFree 42 +class __SrsAutoFree
43 { 43 {
44 private: 44 private:
45 T** ptr; 45 T** ptr;
@@ -49,12 +49,12 @@ public: @@ -49,12 +49,12 @@ public:
49 * auto delete the ptr. 49 * auto delete the ptr.
50 * @is_array a bool value indicates whether the ptr is a array. 50 * @is_array a bool value indicates whether the ptr is a array.
51 */ 51 */
52 - c__SrsAutoFree(T** _ptr, bool _is_array){ 52 + __SrsAutoFree(T** _ptr, bool _is_array){
53 ptr = _ptr; 53 ptr = _ptr;
54 is_array = _is_array; 54 is_array = _is_array;
55 } 55 }
56 56
57 - virtual ~c__SrsAutoFree(){ 57 + virtual ~__SrsAutoFree(){
58 if (ptr == NULL || *ptr == NULL) { 58 if (ptr == NULL || *ptr == NULL) {
59 return; 59 return;
60 } 60 }
@@ -22,3 +22,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -22,3 +22,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */ 22 */
23 23
24 #include <srs_core_buffer.hpp> 24 #include <srs_core_buffer.hpp>
  25 +
  26 +SrsBuffer::SrsBuffer()
  27 +{
  28 +}
  29 +
  30 +SrsBuffer::~SrsBuffer()
  31 +{
  32 +}
  33 +
@@ -30,4 +30,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -30,4 +30,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 30
31 #include <srs_core.hpp> 31 #include <srs_core.hpp>
32 32
  33 +/**
  34 +* the buffer provices bytes cache for protocol. generally,
  35 +* protocol recv data from socket, put into buffer, decode to RTMP message.
  36 +* protocol encode RTMP message to bytes, put into buffer, send to socket.
  37 +*/
  38 +class SrsBuffer
  39 +{
  40 +public:
  41 + SrsBuffer();
  42 + virtual ~SrsBuffer();
  43 +};
  44 +
33 #endif 45 #endif
@@ -33,6 +33,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -33,6 +33,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #include <srs_core_conn.hpp> 33 #include <srs_core_conn.hpp>
34 34
35 class SrsRtmp; 35 class SrsRtmp;
  36 +
  37 +/**
  38 +* the client provides the main logic control for RTMP clients.
  39 +*/
36 class SrsClient : public SrsConnection 40 class SrsClient : public SrsConnection
37 { 41 {
38 private: 42 private:
@@ -83,7 +83,7 @@ void SrsConnection::cycle() @@ -83,7 +83,7 @@ void SrsConnection::cycle()
83 void* SrsConnection::cycle_thread(void* arg) 83 void* SrsConnection::cycle_thread(void* arg)
84 { 84 {
85 SrsConnection* conn = (SrsConnection*)arg; 85 SrsConnection* conn = (SrsConnection*)arg;
86 - SrsAssert(conn != NULL); 86 + srs_assert(conn != NULL);
87 87
88 conn->cycle(); 88 conn->cycle();
89 89
@@ -32,6 +32,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -32,6 +32,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 32
33 #include <st.h> 33 #include <st.h>
34 34
  35 +/**
  36 +* the protocol provides the rtmp-message-protocol services,
  37 +* to recv RTMP message from RTMP chunk stream,
  38 +* and to send out RTMP message over RTMP chunk stream.
  39 +*/
35 class SrsProtocol 40 class SrsProtocol
36 { 41 {
37 private: 42 private:
@@ -34,13 +34,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -34,13 +34,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 34
35 #include <st.h> 35 #include <st.h>
36 36
  37 +class SrsProtocol;
  38 +
37 struct SrsApp 39 struct SrsApp
38 { 40 {
39 std::string vhost; 41 std::string vhost;
40 std::string app; 42 std::string app;
41 }; 43 };
42 44
43 -class SrsProtocol; 45 +/**
  46 +* the rtmp provices rtmp-command-protocol services,
  47 +* a high level protocol, media stream oriented services,
  48 +* such as connect to vhost/app, play stream, get audio/video data.
  49 +*/
44 class SrsRtmp 50 class SrsRtmp
45 { 51 {
46 private: 52 private:
@@ -203,7 +203,7 @@ void SrsServer::listen_cycle() @@ -203,7 +203,7 @@ void SrsServer::listen_cycle()
203 void* SrsServer::listen_thread(void* arg) 203 void* SrsServer::listen_thread(void* arg)
204 { 204 {
205 SrsServer* server = (SrsServer*)arg; 205 SrsServer* server = (SrsServer*)arg;
206 - SrsAssert(server != NULL); 206 + srs_assert(server != NULL);
207 207
208 server->listen_cycle(); 208 server->listen_cycle();
209 209
@@ -32,7 +32,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -32,7 +32,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 32
33 #include <st.h> 33 #include <st.h>
34 34
35 -// the socket base on st. 35 +/**
  36 +* the socket provides TCP socket over st,
  37 +* that is, the sync socket mechanism.
  38 +*/
36 class Socket 39 class Socket
37 { 40 {
38 private: 41 private: