winlin

update donation

@@ -15,6 +15,7 @@ RMB 500-999 @@ -15,6 +15,7 @@ RMB 500-999
15 * [2015-04-11 12:48] 丁一 15 * [2015-04-11 12:48] 丁一
16 16
17 RMB 100-499 17 RMB 100-499
  18 +* [2015-05-07 23:56] 余世兵
18 * [2015-05-07 11:34] 王隆萼 19 * [2015-05-07 11:34] 王隆萼
19 * [2015-05-06 22:04] 姜庆东 20 * [2015-05-06 22:04] 姜庆东
20 * [2015-04-10 19:52] 阳成飞 21 * [2015-04-10 19:52] 阳成飞
@@ -256,6 +256,7 @@ int main(int argc, char** argv) @@ -256,6 +256,7 @@ int main(int argc, char** argv)
256 } 256 }
257 } 257 }
258 258
  259 + u_int32_t pre_timestamp = 0;
259 for (;;) { 260 for (;;) {
260 int size; 261 int size;
261 char type; 262 char type;
@@ -267,10 +268,11 @@ int main(int argc, char** argv) @@ -267,10 +268,11 @@ int main(int argc, char** argv)
267 goto rtmp_destroy; 268 goto rtmp_destroy;
268 } 269 }
269 270
270 - if (srs_human_print_rtmp_packet(type, timestamp, data, size) != 0) { 271 + if (srs_human_print_rtmp_packet2(type, timestamp, data, size, pre_timestamp) != 0) {
271 srs_human_trace("print rtmp packet failed."); 272 srs_human_trace("print rtmp packet failed.");
272 goto rtmp_destroy; 273 goto rtmp_destroy;
273 } 274 }
  275 + pre_timestamp = timestamp;
274 276
275 // we only write some types of messages to flv file. 277 // we only write some types of messages to flv file.
276 int is_flv_msg = type == SRS_RTMP_TYPE_AUDIO 278 int is_flv_msg = type == SRS_RTMP_TYPE_AUDIO
@@ -2313,29 +2313,39 @@ const char* srs_human_flv_audio_aac_packet_type2string(char aac_packet_type) @@ -2313,29 +2313,39 @@ const char* srs_human_flv_audio_aac_packet_type2string(char aac_packet_type)
2313 2313
2314 return unknown; 2314 return unknown;
2315 } 2315 }
2316 - 2316 +
2317 int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size) 2317 int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size)
2318 { 2318 {
  2319 + return srs_human_print_rtmp_packet2(type, timestamp, data, size, 0);
  2320 +}
  2321 +
  2322 +int srs_human_print_rtmp_packet2(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp)
  2323 +{
2319 int ret = ERROR_SUCCESS; 2324 int ret = ERROR_SUCCESS;
2320 2325
  2326 + int diff = 0;
  2327 + if (pre_timestamp > 0) {
  2328 + diff = (int)timestamp - (int)pre_timestamp;
  2329 + }
  2330 +
2321 u_int32_t pts; 2331 u_int32_t pts;
2322 if (srs_utils_parse_timestamp(timestamp, type, data, size, &pts) != 0) { 2332 if (srs_utils_parse_timestamp(timestamp, type, data, size, &pts) != 0) {
2323 - srs_human_trace("Rtmp packet type=%s, dts=%d, size=%d, DecodeError",  
2324 - srs_human_flv_tag_type2string(type), timestamp, size 2333 + srs_human_trace("Rtmp packet type=%s, dts=%d, diff=%d, size=%d, DecodeError",
  2334 + srs_human_flv_tag_type2string(type), timestamp, diff, size
2325 ); 2335 );
2326 return ret; 2336 return ret;
2327 } 2337 }
2328 2338
2329 if (type == SRS_RTMP_TYPE_VIDEO) { 2339 if (type == SRS_RTMP_TYPE_VIDEO) {
2330 - srs_human_trace("Video packet type=%s, dts=%d, pts=%d, size=%d, %s(%s,%s)",  
2331 - srs_human_flv_tag_type2string(type), timestamp, pts, size, 2340 + srs_human_trace("Video packet type=%s, dts=%d, pts=%d, diff=%d, size=%d, %s(%s,%s)",
  2341 + srs_human_flv_tag_type2string(type), timestamp, pts, diff, size,
2332 srs_human_flv_video_codec_id2string(srs_utils_flv_video_codec_id(data, size)), 2342 srs_human_flv_video_codec_id2string(srs_utils_flv_video_codec_id(data, size)),
2333 srs_human_flv_video_avc_packet_type2string(srs_utils_flv_video_avc_packet_type(data, size)), 2343 srs_human_flv_video_avc_packet_type2string(srs_utils_flv_video_avc_packet_type(data, size)),
2334 srs_human_flv_video_frame_type2string(srs_utils_flv_video_frame_type(data, size)) 2344 srs_human_flv_video_frame_type2string(srs_utils_flv_video_frame_type(data, size))
2335 ); 2345 );
2336 } else if (type == SRS_RTMP_TYPE_AUDIO) { 2346 } else if (type == SRS_RTMP_TYPE_AUDIO) {
2337 - srs_human_trace("Audio packet type=%s, dts=%d, pts=%d, size=%d, %s(%s,%s,%s,%s)",  
2338 - srs_human_flv_tag_type2string(type), timestamp, pts, size, 2347 + srs_human_trace("Audio packet type=%s, dts=%d, pts=%d, diff=%d, size=%d, %s(%s,%s,%s,%s)",
  2348 + srs_human_flv_tag_type2string(type), timestamp, pts, diff, size,
2339 srs_human_flv_audio_sound_format2string(srs_utils_flv_audio_sound_format(data, size)), 2349 srs_human_flv_audio_sound_format2string(srs_utils_flv_audio_sound_format(data, size)),
2340 srs_human_flv_audio_sound_rate2string(srs_utils_flv_audio_sound_rate(data, size)), 2350 srs_human_flv_audio_sound_rate2string(srs_utils_flv_audio_sound_rate(data, size)),
2341 srs_human_flv_audio_sound_size2string(srs_utils_flv_audio_sound_size(data, size)), 2351 srs_human_flv_audio_sound_size2string(srs_utils_flv_audio_sound_size(data, size)),
@@ -2343,8 +2353,8 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int @@ -2343,8 +2353,8 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int
2343 srs_human_flv_audio_aac_packet_type2string(srs_utils_flv_audio_aac_packet_type(data, size)) 2353 srs_human_flv_audio_aac_packet_type2string(srs_utils_flv_audio_aac_packet_type(data, size))
2344 ); 2354 );
2345 } else if (type == SRS_RTMP_TYPE_SCRIPT) { 2355 } else if (type == SRS_RTMP_TYPE_SCRIPT) {
2346 - srs_human_verbose("Data packet type=%s, time=%d, size=%d",  
2347 - srs_human_flv_tag_type2string(type), timestamp, size); 2356 + srs_human_verbose("Data packet type=%s, time=%d, diff=%d, size=%d",
  2357 + srs_human_flv_tag_type2string(type), timestamp, diff, size);
2348 int nparsed = 0; 2358 int nparsed = 0;
2349 while (nparsed < size) { 2359 while (nparsed < size) {
2350 int nb_parsed_this = 0; 2360 int nb_parsed_this = 0;
@@ -2360,8 +2370,8 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int @@ -2360,8 +2370,8 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int
2360 srs_freep(amf0_str); 2370 srs_freep(amf0_str);
2361 } 2371 }
2362 } else { 2372 } else {
2363 - srs_human_trace("Rtmp packet type=%#x, dts=%d, pts=%d, size=%d",  
2364 - type, timestamp, pts, size); 2373 + srs_human_trace("Rtmp packet type=%#x, dts=%d, pts=%d, diff=%d, size=%d",
  2374 + type, timestamp, pts, diff, size);
2365 } 2375 }
2366 2376
2367 return ret; 2377 return ret;
@@ -901,8 +901,9 @@ extern const char* srs_human_flv_audio_aac_packet_type2string(char aac_packet_ty @@ -901,8 +901,9 @@ extern const char* srs_human_flv_audio_aac_packet_type2string(char aac_packet_ty
901 * print the rtmp packet, use srs_human_trace/srs_human_verbose for packet, 901 * print the rtmp packet, use srs_human_trace/srs_human_verbose for packet,
902 * and use srs_human_raw for script data body. 902 * and use srs_human_raw for script data body.
903 * @return an error code for parse the timetstamp to dts and pts. 903 * @return an error code for parse the timetstamp to dts and pts.
904 -*/ 904 + */
905 extern int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size); 905 extern int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size);
  906 +extern int srs_human_print_rtmp_packet2(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp);
906 907
907 // log to console, for use srs-librtmp application. 908 // log to console, for use srs-librtmp application.
908 extern const char* srs_human_format_time(); 909 extern const char* srs_human_format_time();