winlin

update donation

... ... @@ -15,6 +15,7 @@ RMB 500-999
* [2015-04-11 12:48] 丁一
RMB 100-499
* [2015-05-07 23:56] 余世兵
* [2015-05-07 11:34] 王隆萼
* [2015-05-06 22:04] 姜庆东
* [2015-04-10 19:52] 阳成飞
... ...
... ... @@ -256,6 +256,7 @@ int main(int argc, char** argv)
}
}
u_int32_t pre_timestamp = 0;
for (;;) {
int size;
char type;
... ... @@ -267,10 +268,11 @@ int main(int argc, char** argv)
goto rtmp_destroy;
}
if (srs_human_print_rtmp_packet(type, timestamp, data, size) != 0) {
if (srs_human_print_rtmp_packet2(type, timestamp, data, size, pre_timestamp) != 0) {
srs_human_trace("print rtmp packet failed.");
goto rtmp_destroy;
}
pre_timestamp = timestamp;
// we only write some types of messages to flv file.
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)
return unknown;
}
int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size)
{
return srs_human_print_rtmp_packet2(type, timestamp, data, size, 0);
}
int srs_human_print_rtmp_packet2(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp)
{
int ret = ERROR_SUCCESS;
int diff = 0;
if (pre_timestamp > 0) {
diff = (int)timestamp - (int)pre_timestamp;
}
u_int32_t pts;
if (srs_utils_parse_timestamp(timestamp, type, data, size, &pts) != 0) {
srs_human_trace("Rtmp packet type=%s, dts=%d, size=%d, DecodeError",
srs_human_flv_tag_type2string(type), timestamp, size
srs_human_trace("Rtmp packet type=%s, dts=%d, diff=%d, size=%d, DecodeError",
srs_human_flv_tag_type2string(type), timestamp, diff, size
);
return ret;
}
if (type == SRS_RTMP_TYPE_VIDEO) {
srs_human_trace("Video packet type=%s, dts=%d, pts=%d, size=%d, %s(%s,%s)",
srs_human_flv_tag_type2string(type), timestamp, pts, size,
srs_human_trace("Video packet type=%s, dts=%d, pts=%d, diff=%d, size=%d, %s(%s,%s)",
srs_human_flv_tag_type2string(type), timestamp, pts, diff, size,
srs_human_flv_video_codec_id2string(srs_utils_flv_video_codec_id(data, size)),
srs_human_flv_video_avc_packet_type2string(srs_utils_flv_video_avc_packet_type(data, size)),
srs_human_flv_video_frame_type2string(srs_utils_flv_video_frame_type(data, size))
);
} else if (type == SRS_RTMP_TYPE_AUDIO) {
srs_human_trace("Audio packet type=%s, dts=%d, pts=%d, size=%d, %s(%s,%s,%s,%s)",
srs_human_flv_tag_type2string(type), timestamp, pts, size,
srs_human_trace("Audio packet type=%s, dts=%d, pts=%d, diff=%d, size=%d, %s(%s,%s,%s,%s)",
srs_human_flv_tag_type2string(type), timestamp, pts, diff, size,
srs_human_flv_audio_sound_format2string(srs_utils_flv_audio_sound_format(data, size)),
srs_human_flv_audio_sound_rate2string(srs_utils_flv_audio_sound_rate(data, size)),
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
srs_human_flv_audio_aac_packet_type2string(srs_utils_flv_audio_aac_packet_type(data, size))
);
} else if (type == SRS_RTMP_TYPE_SCRIPT) {
srs_human_verbose("Data packet type=%s, time=%d, size=%d",
srs_human_flv_tag_type2string(type), timestamp, size);
srs_human_verbose("Data packet type=%s, time=%d, diff=%d, size=%d",
srs_human_flv_tag_type2string(type), timestamp, diff, size);
int nparsed = 0;
while (nparsed < size) {
int nb_parsed_this = 0;
... ... @@ -2360,8 +2370,8 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int
srs_freep(amf0_str);
}
} else {
srs_human_trace("Rtmp packet type=%#x, dts=%d, pts=%d, size=%d",
type, timestamp, pts, size);
srs_human_trace("Rtmp packet type=%#x, dts=%d, pts=%d, diff=%d, size=%d",
type, timestamp, pts, diff, size);
}
return ret;
... ...
... ... @@ -901,8 +901,9 @@ extern const char* srs_human_flv_audio_aac_packet_type2string(char aac_packet_ty
* print the rtmp packet, use srs_human_trace/srs_human_verbose for packet,
* and use srs_human_raw for script data body.
* @return an error code for parse the timetstamp to dts and pts.
*/
*/
extern int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int size);
extern int srs_human_print_rtmp_packet2(char type, u_int32_t timestamp, char* data, int size, u_int32_t pre_timestamp);
// log to console, for use srs-librtmp application.
extern const char* srs_human_format_time();
... ...