winlin

add comments for all RTMP packets.

@@ -1172,15 +1172,19 @@ class SrsSampleAccessPacket : public SrsPacket @@ -1172,15 +1172,19 @@ class SrsSampleAccessPacket : public SrsPacket
1172 { 1172 {
1173 public: 1173 public:
1174 /** 1174 /**
1175 - * 1175 + * Name of command. Set to "|RtmpSampleAccess".
1176 */ 1176 */
1177 std::string command_name; 1177 std::string command_name;
1178 /** 1178 /**
1179 - * 1179 + * whether allow access the sample of video.
  1180 + * @see: https://github.com/winlinvip/simple-rtmp-server/issues/49
  1181 + * @see: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#videoSampleAccess
1180 */ 1182 */
1181 bool video_sample_access; 1183 bool video_sample_access;
1182 /** 1184 /**
1183 - * 1185 + * whether allow access the sample of audio.
  1186 + * @see: https://github.com/winlinvip/simple-rtmp-server/issues/49
  1187 + * @see: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#audioSampleAccess
1184 */ 1188 */
1185 bool audio_sample_access; 1189 bool audio_sample_access;
1186 public: 1190 public:
@@ -1203,7 +1207,13 @@ protected: @@ -1203,7 +1207,13 @@ protected:
1203 class SrsOnMetaDataPacket : public SrsPacket 1207 class SrsOnMetaDataPacket : public SrsPacket
1204 { 1208 {
1205 public: 1209 public:
  1210 + /**
  1211 + * Name of metadata. Set to "onMetaData"
  1212 + */
1206 std::string name; 1213 std::string name;
  1214 + /**
  1215 + * Metadata of stream.
  1216 + */
1207 SrsAmf0Object* metadata; 1217 SrsAmf0Object* metadata;
1208 public: 1218 public:
1209 SrsOnMetaDataPacket(); 1219 SrsOnMetaDataPacket();
@@ -1273,6 +1283,10 @@ protected: @@ -1273,6 +1283,10 @@ protected:
1273 class SrsSetChunkSizePacket : public SrsPacket 1283 class SrsSetChunkSizePacket : public SrsPacket
1274 { 1284 {
1275 public: 1285 public:
  1286 + /**
  1287 + * The maximum chunk size can be 65536 bytes. The chunk size is
  1288 + * maintained independently for each direction.
  1289 + */
1276 int32_t chunk_size; 1290 int32_t chunk_size;
1277 public: 1291 public:
1278 SrsSetChunkSizePacket(); 1292 SrsSetChunkSizePacket();
@@ -1325,14 +1339,16 @@ enum SrcPCUCEventType @@ -1325,14 +1339,16 @@ enum SrcPCUCEventType
1325 }; 1339 };
1326 1340
1327 /** 1341 /**
  1342 +* 5.4. User Control Message (4)
  1343 +*
1328 * for the EventData is 4bytes. 1344 * for the EventData is 4bytes.
1329 -* Stream Begin(=0) 4-bytes stream ID  
1330 -* Stream EOF(=1) 4-bytes stream ID  
1331 -* StreamDry(=2) 4-bytes stream ID  
1332 -* SetBufferLength(=3) 8-bytes 4bytes stream ID, 4bytes buffer length.  
1333 -* StreamIsRecorded(=4) 4-bytes stream ID  
1334 -* PingRequest(=6) 4-bytes timestamp local server time  
1335 -* PingResponse(=7) 4-bytes timestamp received ping request. 1345 +* Stream Begin(=0) 4-bytes stream ID
  1346 +* Stream EOF(=1) 4-bytes stream ID
  1347 +* StreamDry(=2) 4-bytes stream ID
  1348 +* SetBufferLength(=3) 8-bytes 4bytes stream ID, 4bytes buffer length.
  1349 +* StreamIsRecorded(=4) 4-bytes stream ID
  1350 +* PingRequest(=6) 4-bytes timestamp local server time
  1351 +* PingResponse(=7) 4-bytes timestamp received ping request.
1336 * 1352 *
1337 * 3.7. User Control message 1353 * 3.7. User Control message
1338 * +------------------------------+------------------------- 1354 * +------------------------------+-------------------------
@@ -1343,7 +1359,10 @@ enum SrcPCUCEventType @@ -1343,7 +1359,10 @@ enum SrcPCUCEventType
1343 class SrsUserControlPacket : public SrsPacket 1359 class SrsUserControlPacket : public SrsPacket
1344 { 1360 {
1345 public: 1361 public:
1346 - // @see: SrcPCUCEventType 1362 + /**
  1363 + * Event type is followed by Event data.
  1364 + * @see: SrcPCUCEventType
  1365 + */
1347 int16_t event_type; 1366 int16_t event_type;
1348 int32_t event_data; 1367 int32_t event_data;
1349 /** 1368 /**
@@ -72,7 +72,7 @@ int MockSrsFileWriter::write(void* buf, size_t count, ssize_t* pnwrite) @@ -72,7 +72,7 @@ int MockSrsFileWriter::write(void* buf, size_t count, ssize_t* pnwrite)
72 { 72 {
73 int ret = ERROR_SUCCESS; 73 int ret = ERROR_SUCCESS;
74 74
75 - int size = srs_min(MAX_MOCK_DATA_SIZE - offset, count); 75 + int size = srs_min(MAX_MOCK_DATA_SIZE - offset, (int)count);
76 76
77 memcpy(data + offset, buf, size); 77 memcpy(data + offset, buf, size);
78 78