winlin

extract method to process publish message

... ... @@ -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());
}
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
if (msg->header.is_audio() && ((ret = source->on_audio(msg)) != ERROR_SUCCESS)) {
srs_error("process audio message failed. ret=%d", ret);
... ... @@ -378,11 +391,11 @@ int SrsClient::publish(SrsSource* source, bool is_fmle)
return ret;
}
srs_trace("process onMetaData message success.");
continue;
return ret;
}
srs_trace("ignore AMF0/AMF3 data message.");
continue;
return ret;
}
// process UnPublish event.
... ... @@ -405,8 +418,7 @@ int SrsClient::publish(SrsSource* source, bool is_fmle)
}
srs_trace("ignore AMF0/AMF3 command message.");
continue;
}
return ret;
}
return ret;
... ...
... ... @@ -39,6 +39,7 @@ class SrsSource;
class SrsRefer;
class SrsConsumer;
class SrsCommonMessage;
class SrsHLS;
/**
* the client provides the main logic control for RTMP clients.
... ... @@ -60,6 +61,7 @@ private:
virtual int check_vhost();
virtual int playing(SrsSource* source);
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 process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg);
};
... ...