For #813, refine code.

pull/823/head
winlin 8 years ago
parent 8ad934a8a4
commit 2980e7d3ef

@ -462,7 +462,7 @@ bool SrsHlsMuxer::is_segment_overflow()
// use N% deviation, to smoother. // use N% deviation, to smoother.
double deviation = hls_ts_floor? SRS_HLS_FLOOR_REAP_PERCENT * deviation_ts * hls_fragment : 0.0; 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); current->duration(), hls_fragment + deviation, deviation, deviation_ts, hls_fragment);
return current->duration() >= (hls_fragment + deviation) * 1000; return current->duration() >= (hls_fragment + deviation) * 1000;
@ -485,7 +485,7 @@ bool SrsHlsMuxer::is_segment_absolutely_overflow()
// use N% deviation, to smoother. // use N% deviation, to smoother.
double deviation = hls_ts_floor? SRS_HLS_FLOOR_REAP_PERCENT * deviation_ts * hls_fragment : 0.0; 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); current->duration(), hls_fragment + deviation, deviation, deviation_ts, hls_fragment);
return current->duration() >= (hls_aof_ratio * hls_fragment + deviation) * 1000; 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) { if ((ret = async->execute(new SrsDvrAsyncCallOnHlsNotify(_srs_context->get_id(), req, current->uri))) != ERROR_SUCCESS) {
return ret; return ret;
} }
//current->start_dts is private . log_desc is removed? srs_info("Reap ts segment, sequence_no=%d, uri=%s, duration=%"PRId64"ms", current->sequence_no, current->uri.c_str(), current->duration());
srs_info("eap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64,
current->sequence_no, current->uri.c_str(), current->duration());
// close the muxer of finished segment. // close the muxer of finished segment.
srs_freep(current->tscw); srs_freep(current->tscw);
@ -600,7 +598,7 @@ int SrsHlsMuxer::segment_close()
// reuse current segment index. // reuse current segment index.
_sequence_no--; _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 // rename from tmp to real path
if ((ret = current->unlink_tmpfile()) != ERROR_SUCCESS) { if ((ret = current->unlink_tmpfile()) != ERROR_SUCCESS) {
@ -997,9 +995,6 @@ int SrsHls::cycle()
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
//source is removed?
//srs_info("hls cycle for source %d", source->source_id());
if (last_update_time <= 0) { if (last_update_time <= 0) {
last_update_time = srs_get_system_time_ms(); last_update_time = srs_get_system_time_ms();
} }

@ -211,10 +211,7 @@ int SrsRtspListener::listen(string i, int p)
srs_error("rtsp caster listen failed. ret=%d", ret); srs_error("rtsp caster listen failed. ret=%d", ret);
return ret; return ret;
} }
// pthread is removed? 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_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_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(type).c_str(), ip.c_str(), port, listener->fd()); 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; 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", port, type, listener->fd(), ip.c_str(), port);
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_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(type).c_str(), ip.c_str(), port, listener->fd()); srs_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(type).c_str(), ip.c_str(), port, listener->fd());

@ -1395,9 +1395,8 @@ int SrsFormat::audio_mp3_demux(SrsBuffer* stream, int64_t timestamp)
return ret; return ret;
} }
// format is sound_format? srs_info("audio decoded, codec=%d, ssize=%d, srate=%d, channels=%d, size=%d",
srs_info("audio decoded, type=%d, codec=%d, asize=%d, rate=%d, format=%d, size=%d", acodec->id, acodec->sound_size, acodec->sound_rate, acodec->sound_type, size);
acodec->sound_type, acodec->id, acodec->sound_size, acodec->sound_rate, sound_format, size);
return ret; return ret;
} }

@ -517,11 +517,13 @@ class SrsAudioCodecConfig : public SrsCodecConfig
{ {
// In FLV specification. // In FLV specification.
public: public:
// audio specified // The audio codec id; for FLV, it's SoundFormat.
SrsAudioCodecId id; SrsAudioCodecId id;
// audio aac specified. // The audio sample rate; for FLV, it's SoundRate.
SrsAudioSampleRate sound_rate; SrsAudioSampleRate sound_rate;
// The audio sample size, such as 16 bits; for FLV, it's SoundSize.
SrsAudioSampleBits sound_size; SrsAudioSampleBits sound_size;
// The audio number of channels; for FLV, it's SoundType.
// TODO: FIXME: Rename to sound_channels. // TODO: FIXME: Rename to sound_channels.
SrsAudioChannels sound_type; SrsAudioChannels sound_type;
int audio_data_rate; // in bps int audio_data_rate; // in bps

Loading…
Cancel
Save