1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for bug #194, refine code, remove the old duplicated code.

This commit is contained in:
winlin 2014-11-13 16:56:41 +08:00
parent 1f5c82ecc4
commit 8845bb7caf
12 changed files with 42 additions and 119 deletions

View file

@ -474,7 +474,7 @@ int SrsEdgeForwarder::cycle()
SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_EDGE);
SrsSharedPtrMessageArray msgs(SYS_MAX_EDGE_SEND_MSGS);
SrsMessageArray msgs(SYS_MAX_EDGE_SEND_MSGS);
while (pthread->can_loop()) {
if (send_error_code != ERROR_SUCCESS) {
@ -526,7 +526,7 @@ int SrsEdgeForwarder::cycle()
// @remark, becareful, all msgs must be free explicitly,
// free by send_and_free_message or srs_freep.
for (int i = 0; i < count; i++) {
SrsSharedPtrMessage* msg = msgs.msgs[i];
SrsMessage* msg = msgs.msgs[i];
srs_assert(msg);
msgs.msgs[i] = NULL;

View file

@ -381,7 +381,7 @@ int SrsForwarder::forward()
SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_FORWARDER);
SrsSharedPtrMessageArray msgs(SYS_MAX_FORWARD_SEND_MSGS);
SrsMessageArray msgs(SYS_MAX_FORWARD_SEND_MSGS);
// update sequence header
// TODO: FIXME: maybe need to zero the sequence header timestamp.
@ -442,7 +442,7 @@ int SrsForwarder::forward()
// @remark, becareful, all msgs must be free explicitly,
// free by send_and_free_message or srs_freep.
for (int i = 0; i < count; i++) {
SrsSharedPtrMessage* msg = msgs.msgs[i];
SrsMessage* msg = msgs.msgs[i];
srs_assert(msg);
msgs.msgs[i] = NULL;

View file

@ -517,7 +517,7 @@ int SrsRtmpConn::playing(SrsSource* source)
// initialize other components
SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER);
SrsSharedPtrMessageArray msgs(SYS_CONSTS_MAX_PLAY_SEND_MSGS);
SrsMessageArray msgs(SYS_CONSTS_MAX_PLAY_SEND_MSGS);
bool user_specified_duration_to_stop = (req->duration > 0);
int64_t starttime = -1;
@ -574,7 +574,7 @@ int SrsRtmpConn::playing(SrsSource* source)
// we start to collect the durations for each message.
if (user_specified_duration_to_stop) {
for (int i = 0; i < count; i++) {
SrsSharedPtrMessage* msg = msgs.msgs[i];
SrsMessage* msg = msgs.msgs[i];
// foreach msg, collect the duration.
// @remark: never use msg when sent it, for the protocol sdk will free it.

View file

@ -192,7 +192,7 @@ int SrsMessageQueue::enqueue(SrsSharedPtrMessage* msg)
return ret;
}
int SrsMessageQueue::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, int& count)
int SrsMessageQueue::dump_packets(int max_count, SrsMessage** pmsgs, int& count)
{
int ret = ERROR_SUCCESS;
@ -207,7 +207,7 @@ int SrsMessageQueue::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, in
pmsgs[i] = msgs[i];
}
SrsSharedPtrMessage* last = msgs[count - 1];
SrsMessage* last = msgs[count - 1];
av_start_time = last->header.timestamp;
if (count == (int)msgs.size()) {
@ -332,7 +332,7 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* msg, bool atc, int tba, int tbv, S
return ret;
}
int SrsConsumer::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, int& count)
int SrsConsumer::dump_packets(int max_count, SrsMessage** pmsgs, int& count)
{
srs_assert(max_count > 0);

View file

@ -132,7 +132,7 @@ public:
* @count the count in array, output param.
* @max_count the max count to dequeue, must be positive.
*/
virtual int dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, int& count);
virtual int dump_packets(int max_count, SrsMessage** pmsgs, int& count);
private:
/**
* remove a gop from the front.
@ -187,7 +187,7 @@ public:
* @count the count in array, output param.
* @max_count the max count to dequeue, must be positive.
*/
virtual int dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, int& count);
virtual int dump_packets(int max_count, SrsMessage** pmsgs, int& count);
/**
* when client send the pause message.
*/