mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
extract method to process publish message
This commit is contained in:
parent
195a857f22
commit
b87318dec0
2 changed files with 62 additions and 48 deletions
|
@ -352,6 +352,19 @@ int SrsClient::publish(SrsSource* source, bool is_fmle)
|
||||||
(int)(srs_get_system_time_ms()/1000), pithy_print.get_age(), rtmp->get_send_bytes(), rtmp->get_recv_bytes(), rtmp->get_send_kbps(), rtmp->get_recv_kbps());
|
(int)(srs_get_system_time_ms()/1000), pithy_print.get_age(), rtmp->get_send_bytes(), rtmp->get_recv_bytes(), rtmp->get_send_kbps(), rtmp->get_recv_kbps());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((ret = process_publish_message(source, hls, msg, is_fmle)) != ERROR_SUCCESS) {
|
||||||
|
srs_error("process publish message failed. ret=%d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SrsClient::process_publish_message(SrsSource* source, SrsHLS* hls, SrsCommonMessage* msg, bool is_fmle)
|
||||||
|
{
|
||||||
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
// process audio packet
|
// process audio packet
|
||||||
if (msg->header.is_audio() && ((ret = source->on_audio(msg)) != ERROR_SUCCESS)) {
|
if (msg->header.is_audio() && ((ret = source->on_audio(msg)) != ERROR_SUCCESS)) {
|
||||||
srs_error("process audio message failed. ret=%d", ret);
|
srs_error("process audio message failed. ret=%d", ret);
|
||||||
|
@ -378,11 +391,11 @@ int SrsClient::publish(SrsSource* source, bool is_fmle)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
srs_trace("process onMetaData message success.");
|
srs_trace("process onMetaData message success.");
|
||||||
continue;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_trace("ignore AMF0/AMF3 data message.");
|
srs_trace("ignore AMF0/AMF3 data message.");
|
||||||
continue;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// process UnPublish event.
|
// process UnPublish event.
|
||||||
|
@ -405,8 +418,7 @@ int SrsClient::publish(SrsSource* source, bool is_fmle)
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_trace("ignore AMF0/AMF3 command message.");
|
srs_trace("ignore AMF0/AMF3 command message.");
|
||||||
continue;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -39,6 +39,7 @@ class SrsSource;
|
||||||
class SrsRefer;
|
class SrsRefer;
|
||||||
class SrsConsumer;
|
class SrsConsumer;
|
||||||
class SrsCommonMessage;
|
class SrsCommonMessage;
|
||||||
|
class SrsHLS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the client provides the main logic control for RTMP clients.
|
* the client provides the main logic control for RTMP clients.
|
||||||
|
@ -60,6 +61,7 @@ private:
|
||||||
virtual int check_vhost();
|
virtual int check_vhost();
|
||||||
virtual int playing(SrsSource* source);
|
virtual int playing(SrsSource* source);
|
||||||
virtual int publish(SrsSource* source, bool is_fmle);
|
virtual int publish(SrsSource* source, bool is_fmle);
|
||||||
|
virtual int process_publish_message(SrsSource* source, SrsHLS* hls, SrsCommonMessage* msg, bool is_fmle);
|
||||||
virtual int get_peer_ip();
|
virtual int get_peer_ip();
|
||||||
virtual int process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg);
|
virtual int process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue