mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add hds reload supported.#328
This commit is contained in:
parent
abe0713980
commit
643f18abe4
9 changed files with 75 additions and 3 deletions
|
@ -267,6 +267,7 @@ SrsHds::SrsHds(SrsSource *s)
|
|||
, video_sh(NULL)
|
||||
, audio_sh(NULL)
|
||||
, hds_req(NULL)
|
||||
, hds_enabled(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -278,9 +279,18 @@ SrsHds::~SrsHds()
|
|||
|
||||
int SrsHds::on_publish(SrsRequest *req)
|
||||
{
|
||||
// TODO: FIXME: check whether disabled.
|
||||
// TODO: FIXME: support reload.
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
if (hds_enabled) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string vhost = req->vhost;
|
||||
if (!_srs_config->get_hds_enabled(vhost)) {
|
||||
hds_enabled = false;
|
||||
return ret;
|
||||
}
|
||||
hds_enabled = true;
|
||||
|
||||
hds_req = req->copy();
|
||||
|
||||
return flush_mainfest();
|
||||
|
@ -290,6 +300,12 @@ int SrsHds::on_unpublish()
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (!hds_enabled) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
hds_enabled = false;
|
||||
|
||||
srs_freep(video_sh);
|
||||
srs_freep(audio_sh);
|
||||
srs_freep(hds_req);
|
||||
|
@ -313,6 +329,10 @@ int SrsHds::on_video(SrsSharedPtrMessage* msg)
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (!hds_enabled) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (SrsFlvCodec::video_is_sequence_header(msg->payload, msg->size)) {
|
||||
srs_freep(video_sh);
|
||||
video_sh = msg->copy();
|
||||
|
@ -361,6 +381,10 @@ int SrsHds::on_audio(SrsSharedPtrMessage* msg)
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (!hds_enabled) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (SrsFlvCodec::audio_is_sequence_header(msg->payload, msg->size)) {
|
||||
srs_freep(audio_sh);
|
||||
audio_sh = msg->copy();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue