mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine code, fix bug of hls, following jetbrains clion code-inspector. 0.9.215
This commit is contained in:
parent
4a323e64c4
commit
002facb85b
21 changed files with 73 additions and 84 deletions
|
@ -177,7 +177,7 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample
|
|||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = stream->initialize((char*)data, size)) != ERROR_SUCCESS) {
|
||||
if ((ret = stream->initialize(data, size)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,8 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample
|
|||
case 44100:
|
||||
sample->sound_rate = SrsCodecAudioSampleRate44100;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -320,7 +322,7 @@ int SrsAvcAacCodec::video_avc_demux(char* data, int size, SrsCodecSample* sample
|
|||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = stream->initialize((char*)data, size)) != ERROR_SUCCESS) {
|
||||
if ((ret = stream->initialize(data, size)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -467,9 +469,9 @@ int SrsAvcAacCodec::video_avc_demux(char* data, int size, SrsCodecSample* sample
|
|||
int32_t NALUnitLength = 0;
|
||||
if (NAL_unit_length == 3) {
|
||||
NALUnitLength = stream->read_4bytes();
|
||||
} else if (NALUnitLength == 2) {
|
||||
} else if (NAL_unit_length == 2) {
|
||||
NALUnitLength = stream->read_3bytes();
|
||||
} else if (NALUnitLength == 1) {
|
||||
} else if (NAL_unit_length == 1) {
|
||||
NALUnitLength = stream->read_2bytes();
|
||||
} else {
|
||||
NALUnitLength = stream->read_1bytes();
|
||||
|
|
|
@ -57,8 +57,8 @@ SrsBandwidthSample::~SrsBandwidthSample()
|
|||
|
||||
void SrsBandwidthSample::calc_kbps(int _bytes, int _duration)
|
||||
{
|
||||
bytes = (int)_bytes;
|
||||
actual_duration_ms = (int)_duration;
|
||||
bytes = _bytes;
|
||||
actual_duration_ms = _duration;
|
||||
|
||||
if (actual_duration_ms <= 0) {
|
||||
return;
|
||||
|
|
|
@ -21,8 +21,8 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SRS_APP_CONIFG_HPP
|
||||
#define SRS_APP_CONIFG_HPP
|
||||
#ifndef SRS_APP_CONFIG_HPP
|
||||
#define SRS_APP_CONFIG_HPP
|
||||
|
||||
/*
|
||||
#include <srs_app_config.hpp>
|
||||
|
|
|
@ -214,8 +214,8 @@ int SrsDvrPlan::on_audio(SrsSharedPtrMessage* audio)
|
|||
return ret;
|
||||
}
|
||||
|
||||
char* payload = (char*)audio->payload;
|
||||
int size = (int)audio->size;
|
||||
char* payload = audio->payload;
|
||||
int size = audio->size;
|
||||
int64_t timestamp = filter_timestamp(audio->header.timestamp);
|
||||
if ((ret = enc->write_audio(timestamp, payload, size)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
|
@ -236,8 +236,8 @@ int SrsDvrPlan::on_video(SrsSharedPtrMessage* video)
|
|||
return ret;
|
||||
}
|
||||
|
||||
char* payload = (char*)video->payload;
|
||||
int size = (int)video->size;
|
||||
char* payload = video->payload;
|
||||
int size = video->size;
|
||||
|
||||
#ifdef SRS_AUTO_HTTP_CALLBACK
|
||||
bool is_key_frame = SrsFlvCodec::video_is_h264(payload, size)
|
||||
|
@ -492,8 +492,8 @@ int SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
char* payload = (char*)msg->payload;
|
||||
int size = (int)msg->size;
|
||||
char* payload = msg->payload;
|
||||
int size = msg->size;
|
||||
bool is_key_frame = SrsFlvCodec::video_is_h264(payload, size)
|
||||
&& SrsFlvCodec::video_is_keyframe(payload, size)
|
||||
&& !SrsFlvCodec::video_is_sequence_header(payload, size);
|
||||
|
|
|
@ -21,8 +21,8 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SRS_APP_EMPYTY_HPP
|
||||
#define SRS_APP_EMPYTY_HPP
|
||||
#ifndef SRS_APP_EMPTY_HPP
|
||||
#define SRS_APP_EMPTY_HPP
|
||||
|
||||
/*
|
||||
#include <srs_app_empty.hpp>
|
||||
|
|
|
@ -141,10 +141,10 @@ void SrsEncoder::clear_engines()
|
|||
|
||||
std::string output = ffmpeg->output();
|
||||
|
||||
std::vector<std::string>::iterator it;
|
||||
it = std::find(_transcoded_url.begin(), _transcoded_url.end(), output);
|
||||
if (it != _transcoded_url.end()) {
|
||||
_transcoded_url.erase(it);
|
||||
std::vector<std::string>::iterator tu_it;
|
||||
tu_it = std::find(_transcoded_url.begin(), _transcoded_url.end(), output);
|
||||
if (tu_it != _transcoded_url.end()) {
|
||||
_transcoded_url.erase(tu_it);
|
||||
}
|
||||
|
||||
srs_freep(ffmpeg);
|
||||
|
|
|
@ -42,8 +42,6 @@ public:
|
|||
virtual ~SrsHttpHeartbeat();
|
||||
public:
|
||||
virtual void heartbeat();
|
||||
public:
|
||||
static void update_local_ipv4_ips();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -163,8 +163,6 @@ bool SrsHttpVhost::is_handler_valid(SrsHttpMessage* req, int& status_code, std::
|
|||
|
||||
int SrsHttpVhost::do_process_request(SrsStSocket* skt, SrsHttpMessage* req)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::string fullpath = get_request_file(req);
|
||||
|
||||
// TODO: FIXME: support mp4, @see https://github.com/winlinvip/simple-rtmp-server/issues/174
|
||||
|
@ -182,11 +180,9 @@ int SrsHttpVhost::do_process_request(SrsStSocket* skt, SrsHttpMessage* req)
|
|||
}
|
||||
|
||||
return response_flv_file2(skt, req, fullpath, offset);
|
||||
} else {
|
||||
return response_regular_file(skt, req, fullpath);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
return response_regular_file(skt, req, fullpath);
|
||||
}
|
||||
|
||||
int SrsHttpVhost::response_regular_file(SrsStSocket* skt, SrsHttpMessage* req, string fullpath)
|
||||
|
|
|
@ -302,8 +302,6 @@ int SrsRtmpConn::service_cycle()
|
|||
srs_error("control message(%d) reject as error. ret=%d", ret, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmpConn::stream_service_cycle()
|
||||
|
@ -462,7 +460,7 @@ int SrsRtmpConn::stream_service_cycle()
|
|||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -851,8 +851,8 @@ int SrsSource::on_dvr_request_sh()
|
|||
// when reload to start dvr, dvr will never get the sequence header in stream,
|
||||
// use the SrsSource.on_dvr_request_sh to push the sequence header to DVR.
|
||||
if (cache_metadata) {
|
||||
char* payload = (char*)cache_metadata->payload;
|
||||
int size = (int)cache_metadata->size;
|
||||
char* payload = cache_metadata->payload;
|
||||
int size = cache_metadata->size;
|
||||
|
||||
SrsStream stream;
|
||||
if ((ret = stream.initialize(payload, size)) != ERROR_SUCCESS) {
|
||||
|
@ -1253,7 +1253,7 @@ int SrsSource::on_aggregate(SrsMessage* msg)
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
SrsStream* stream = aggregate_stream;
|
||||
if ((ret = stream->initialize((char*)msg->payload, msg->size)) != ERROR_SUCCESS) {
|
||||
if ((ret = stream->initialize(msg->payload, msg->size)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -761,7 +761,7 @@ void srs_update_network_devices()
|
|||
|
||||
// @see: read_net_dev() from https://github.com/sysstat/sysstat/blob/master/rd_stats.c#L786
|
||||
// @remark, we use our algorithm, not sysstat.
|
||||
sscanf(buf, "%6[^:]:%llu %lu %lu %lu %lu %lu %lu %lu %llu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
sscanf(buf, "%6[^:]:%llu %lu %lu %lu %lu %lu %lu %lu %llu %lu %lu %lu %lu %lu %lu %lu\n",
|
||||
r.name, &r.rbytes, &r.rpackets, &r.rerrs, &r.rdrop, &r.rfifo, &r.rframe, &r.rcompressed, &r.rmulticast,
|
||||
&r.sbytes, &r.spackets, &r.serrs, &r.sdrop, &r.sfifo, &r.scolls, &r.scarrier, &r.scompressed);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
// state %c One character from the string "RSDZTW" where R is running, S is sleeping in an interruptible wait, D
|
||||
// is waiting in uninterruptible disk sleep, Z is zombie, T is traced or stopped (on a signal), and W is
|
||||
// paging.
|
||||
char state;
|
||||
unsigned char state;
|
||||
// ppid %d The PID of the parent.
|
||||
int ppid;
|
||||
// pgrp %d The process group ID of the process.
|
||||
|
@ -455,12 +455,12 @@ public:
|
|||
// = MemFree + Buffers + Cached
|
||||
u_int64_t NotInUse;
|
||||
|
||||
u_int64_t MemTotal;
|
||||
u_int64_t MemFree;
|
||||
u_int64_t Buffers;
|
||||
u_int64_t Cached;
|
||||
u_int64_t SwapTotal;
|
||||
u_int64_t SwapFree;
|
||||
unsigned long MemTotal;
|
||||
unsigned long MemFree;
|
||||
unsigned long Buffers;
|
||||
unsigned long Cached;
|
||||
unsigned long SwapTotal;
|
||||
unsigned long SwapFree;
|
||||
|
||||
public:
|
||||
SrsMemInfo();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue