From 2980e7d3ef376872760ad9f32b15d83331bac830 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 25 Mar 2017 12:52:54 +0800 Subject: [PATCH] For #813, refine code. --- trunk/src/app/srs_app_hls.cpp | 13 ++++--------- trunk/src/app/srs_app_server.cpp | 10 ++-------- trunk/src/kernel/srs_kernel_codec.cpp | 5 ++--- trunk/src/kernel/srs_kernel_codec.hpp | 6 ++++-- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 19aa79ed6..2a4edd46d 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -462,7 +462,7 @@ bool SrsHlsMuxer::is_segment_overflow() // use N% deviation, to smoother. double deviation = hls_ts_floor? SRS_HLS_FLOOR_REAP_PERCENT * deviation_ts * hls_fragment : 0.0; - srs_info("hls: dur=%.2f, tar=%.2f, dev=%.2fms/%dp, frag=%.2f", + srs_info("hls: dur=%"PRId64"ms, tar=%.2f, dev=%.2fms/%dp, frag=%.2f", current->duration(), hls_fragment + deviation, deviation, deviation_ts, hls_fragment); return current->duration() >= (hls_fragment + deviation) * 1000; @@ -485,7 +485,7 @@ bool SrsHlsMuxer::is_segment_absolutely_overflow() // use N% deviation, to smoother. double deviation = hls_ts_floor? SRS_HLS_FLOOR_REAP_PERCENT * deviation_ts * hls_fragment : 0.0; - srs_info("hls: dur=%.2f, tar=%.2f, dev=%.2fms/%dp, frag=%.2f", + srs_info("hls: dur=%"PRId64"ms, tar=%.2f, dev=%.2fms/%dp, frag=%.2f", current->duration(), hls_fragment + deviation, deviation, deviation_ts, hls_fragment); return current->duration() >= (hls_aof_ratio * hls_fragment + deviation) * 1000; @@ -582,9 +582,7 @@ int SrsHlsMuxer::segment_close() if ((ret = async->execute(new SrsDvrAsyncCallOnHlsNotify(_srs_context->get_id(), req, current->uri))) != ERROR_SUCCESS) { return ret; } - //current->start_dts is private . log_desc is removed? - srs_info("eap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64, - current->sequence_no, current->uri.c_str(), current->duration()); + srs_info("Reap ts segment, sequence_no=%d, uri=%s, duration=%"PRId64"ms", current->sequence_no, current->uri.c_str(), current->duration()); // close the muxer of finished segment. srs_freep(current->tscw); @@ -600,7 +598,7 @@ int SrsHlsMuxer::segment_close() // reuse current segment index. _sequence_no--; - srs_trace("Drop ts segment, sequence_no=%d, uri=%s, duration=%dms", current->sequence_no, current->uri.c_str(), current->duration()); + srs_trace("Drop ts segment, sequence_no=%d, uri=%s, duration=%"PRId64"ms", current->sequence_no, current->uri.c_str(), current->duration()); // rename from tmp to real path if ((ret = current->unlink_tmpfile()) != ERROR_SUCCESS) { @@ -997,9 +995,6 @@ int SrsHls::cycle() { int ret = ERROR_SUCCESS; - //source is removed? - //srs_info("hls cycle for source %d", source->source_id()); - if (last_update_time <= 0) { last_update_time = srs_get_system_time_ms(); } diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 730d02a90..c6a55c26b 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -211,10 +211,7 @@ int SrsRtspListener::listen(string i, int p) srs_error("rtsp caster listen failed. ret=%d", ret); return ret; } - // pthread is removed? - srs_info("listen thread current_cid=%d, " - "listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", - _srs_context->get_id(), port, type, listener->fd(), ip.c_str(), port); + srs_info("listen thread listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", port, type, listener->fd(), ip.c_str(), port); srs_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(type).c_str(), ip.c_str(), port, listener->fd()); @@ -274,10 +271,7 @@ int SrsHttpFlvListener::listen(string i, int p) return ret; } - // pthread is removed? - srs_info("listen thread cid=%d, current_cid=%d, " - "listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", - _srs_context->get_id(), port, type, listener->fd(), ip.c_str(), port); + srs_info("listen thread current_cid=%d, listen at port=%d, type=%d, fd=%d started success, ep=%s:%d", port, type, listener->fd(), ip.c_str(), port); srs_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(type).c_str(), ip.c_str(), port, listener->fd()); diff --git a/trunk/src/kernel/srs_kernel_codec.cpp b/trunk/src/kernel/srs_kernel_codec.cpp index 9cf3aeef7..54bc4c6f1 100644 --- a/trunk/src/kernel/srs_kernel_codec.cpp +++ b/trunk/src/kernel/srs_kernel_codec.cpp @@ -1395,9 +1395,8 @@ int SrsFormat::audio_mp3_demux(SrsBuffer* stream, int64_t timestamp) return ret; } - // format is sound_format? - srs_info("audio decoded, type=%d, codec=%d, asize=%d, rate=%d, format=%d, size=%d", - acodec->sound_type, acodec->id, acodec->sound_size, acodec->sound_rate, sound_format, size); + srs_info("audio decoded, codec=%d, ssize=%d, srate=%d, channels=%d, size=%d", + acodec->id, acodec->sound_size, acodec->sound_rate, acodec->sound_type, size); return ret; } diff --git a/trunk/src/kernel/srs_kernel_codec.hpp b/trunk/src/kernel/srs_kernel_codec.hpp index c27909f8d..5888fc461 100644 --- a/trunk/src/kernel/srs_kernel_codec.hpp +++ b/trunk/src/kernel/srs_kernel_codec.hpp @@ -517,11 +517,13 @@ class SrsAudioCodecConfig : public SrsCodecConfig { // In FLV specification. public: - // audio specified + // The audio codec id; for FLV, it's SoundFormat. SrsAudioCodecId id; - // audio aac specified. + // The audio sample rate; for FLV, it's SoundRate. SrsAudioSampleRate sound_rate; + // The audio sample size, such as 16 bits; for FLV, it's SoundSize. SrsAudioSampleBits sound_size; + // The audio number of channels; for FLV, it's SoundType. // TODO: FIXME: Rename to sound_channels. SrsAudioChannels sound_type; int audio_data_rate; // in bps