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

for #328, support adobe hds. 2.0.138.

This commit is contained in:
winlin 2015-03-12 11:15:15 +08:00
parent da56e4fbb9
commit ffef62900f
13 changed files with 198 additions and 17 deletions

View file

@ -2,7 +2,6 @@
The MIT License (MIT)
Copyright (c) 2013-2015 wenjiegit
Copyright (c) 2013-2015 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@ -23,12 +22,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_app_hds.hpp>
#ifdef SRS_AUTO_HDS
#include <unistd.h>
#include <string>
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
using namespace std;
#include <srs_app_hds.hpp>
#include <srs_rtmp_sdk.hpp>
@ -40,8 +42,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_utility.hpp>
#include <srs_app_config.hpp>
using namespace std;
static void update_box(char *start, int size)
{
char *p_size = (char*)&size;
@ -720,3 +720,5 @@ void SrsHds::adjust_windows()
srs_freep(fragment);
}
}
#endif

View file

@ -2,7 +2,6 @@
The MIT License (MIT)
Copyright (c) 2013-2015 wenjiegit
Copyright (c) 2013-2015 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@ -27,6 +26,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
#ifdef SRS_AUTO_HDS
#include <list>
class SrsRequest;
@ -62,4 +63,6 @@ private:
SrsRequest *hds_req;
};
#endif // SRS_APP_HDS_HPP
#endif
#endif

View file

@ -782,8 +782,9 @@ SrsSource::SrsSource()
#ifdef SRS_AUTO_TRANSCODE
encoder = new SrsEncoder();
#endif
#ifdef SRS_AUTO_HDS
hds = new SrsHds(this);
#endif
cache_metadata = cache_sh_video = cache_sh_audio = NULL;
@ -835,6 +836,9 @@ SrsSource::~SrsSource()
#ifdef SRS_AUTO_TRANSCODE
srs_freep(encoder);
#endif
#ifdef SRS_AUTO_HDS
srs_freep(hds);
#endif
srs_freep(_req);
}
@ -1349,14 +1353,16 @@ int SrsSource::on_audio(SrsCommonMessage* __audio)
}
#endif
#ifdef SRS_AUTO_HDS
if ((ret = hds->on_audio(&msg)) != ERROR_SUCCESS) {
srs_warn("hds process audio message failed, ignore and disable dvr. ret=%d", ret);
// unpublish, ignore ret.
hds->on_unpublish();
// ignore.
ret = ERROR_SUCCESS;
srs_warn("hds process audio message failed, ignore and disable dvr. ret=%d", ret);
}
#endif
// copy to all consumer
int nb_consumers = (int)consumers.size();
@ -1498,14 +1504,16 @@ int SrsSource::on_video(SrsCommonMessage* __video)
}
#endif
#ifdef SRS_AUTO_HDS
if ((ret = hds->on_video(&msg)) != ERROR_SUCCESS) {
srs_warn("hds process video message failed, ignore and disable dvr. ret=%d", ret);
// unpublish, ignore ret.
hds->on_unpublish();
// ignore.
ret = ERROR_SUCCESS;
srs_warn("hds process video message failed, ignore and disable dvr. ret=%d", ret);
}
#endif
// copy to all consumer
if (true) {
@ -1751,10 +1759,12 @@ int SrsSource::on_publish()
}
#endif
#ifdef SRS_AUTO_HDS
if ((ret = hds->on_publish(_req)) != ERROR_SUCCESS) {
srs_error("start hds failed. ret=%d", ret);
return ret;
}
#endif
// notify the handler.
srs_assert(handler);
@ -1783,7 +1793,9 @@ void SrsSource::on_unpublish()
dvr->on_unpublish();
#endif
#ifdef SRS_AUTO_HDS
hds->on_unpublish();
#endif
gop_cache->clear();

View file

@ -62,7 +62,9 @@ class SrsEncoder;
#endif
class SrsStream;
class ISrsHlsHandler;
#ifdef SRS_AUTO_HDS
class SrsHds;
#endif
/**
* the time jitter algorithm:
@ -417,7 +419,9 @@ private:
#ifdef SRS_AUTO_TRANSCODE
SrsEncoder* encoder;
#endif
#ifdef SRS_AUTO_HDS
SrsHds *hds;
#endif
// edge control service
SrsPlayEdge* play_edge;
SrsPublishEdge* publish_edge;

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 137
#define VERSION_REVISION 138
// server info.
#define RTMP_SIG_SRS_KEY "SRS"

View file

@ -72,6 +72,12 @@ void show_macro_features()
srs_warn("check feature hls: off");
#endif
#ifdef SRS_AUTO_HDS
srs_trace("check feature hds: on");
#else
srs_warn("check feature hds: off");
#endif
#ifdef SRS_AUTO_HTTP_CALLBACK
srs_trace("check feature http callback: on");
#else