winlin

add chad.wang to authors for srs-librtmp on windows build project

@@ -6,3 +6,4 @@ Authors ordered by first contribution. @@ -6,3 +6,4 @@ Authors ordered by first contribution.
6 * naijia.liu<youngcow@youngcow.net> 6 * naijia.liu<youngcow@youngcow.net>
7 * alcoholyi<alcoholyi@qq.com> 7 * alcoholyi<alcoholyi@qq.com>
8 * byteman<wangchen2011@gmail.com> 8 * byteman<wangchen2011@gmail.com>
  9 +* chad.wang<chad.wang.cn@gmail.com>
@@ -23,3 +23,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,3 +23,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_app_edge.hpp> 24 #include <srs_app_edge.hpp>
25 25
  26 +#include <srs_kernel_error.hpp>
  27 +
  28 +SrsEdge::SrsEdge()
  29 +{
  30 + state = SrsEdgeStateInit;
  31 +}
  32 +
  33 +SrsEdge::~SrsEdge()
  34 +{
  35 +}
  36 +
  37 +int SrsEdge::on_client_play()
  38 +{
  39 + int ret = ERROR_SUCCESS;
  40 + return ret;
  41 +}
  42 +
@@ -30,4 +30,34 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -30,4 +30,34 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 30
31 #include <srs_core.hpp> 31 #include <srs_core.hpp>
32 32
33 -#endif  
  33 +/**
  34 +* the state of edge
  35 +*/
  36 +enum SrsEdgeState
  37 +{
  38 + SrsEdgeStateInit = 0,
  39 + SrsEdgeStatePlay = 100,
  40 + SrsEdgeStatePublish,
  41 + SrsEdgeStateConnected,
  42 + SrsEdgeStateAborting,
  43 + SrsEdgeStateReloading,
  44 +};
  45 +
  46 +/**
  47 +* edge control service.
  48 +*/
  49 +class SrsEdge
  50 +{
  51 +private:
  52 + SrsEdgeState state;
  53 +public:
  54 + SrsEdge();
  55 + virtual ~SrsEdge();
  56 +public:
  57 + /**
  58 + * when client play stream on edge.
  59 + */
  60 + virtual int on_client_play();
  61 +};
  62 +
  63 +#endif
@@ -38,6 +38,7 @@ using namespace std; @@ -38,6 +38,7 @@ using namespace std;
38 #include <srs_protocol_rtmp.hpp> 38 #include <srs_protocol_rtmp.hpp>
39 #include <srs_app_dvr.hpp> 39 #include <srs_app_dvr.hpp>
40 #include <srs_kernel_stream.hpp> 40 #include <srs_kernel_stream.hpp>
  41 +#include <srs_app_edge.hpp>
41 42
42 #define CONST_MAX_JITTER_MS 500 43 #define CONST_MAX_JITTER_MS 500
43 #define DEFAULT_FRAME_TIME_MS 40 44 #define DEFAULT_FRAME_TIME_MS 40
@@ -455,6 +456,7 @@ SrsSource::SrsSource(SrsRequest* _req) @@ -455,6 +456,7 @@ SrsSource::SrsSource(SrsRequest* _req)
455 frame_rate = sample_rate = 0; 456 frame_rate = sample_rate = 0;
456 _can_publish = true; 457 _can_publish = true;
457 458
  459 + edge = new SrsEdge();
458 gop_cache = new SrsGopCache(); 460 gop_cache = new SrsGopCache();
459 461
460 _srs_config->subscribe(this); 462 _srs_config->subscribe(this);
@@ -487,6 +489,7 @@ SrsSource::~SrsSource() @@ -487,6 +489,7 @@ SrsSource::~SrsSource()
487 srs_freep(cache_sh_video); 489 srs_freep(cache_sh_video);
488 srs_freep(cache_sh_audio); 490 srs_freep(cache_sh_audio);
489 491
  492 + srs_freep(edge);
490 srs_freep(gop_cache); 493 srs_freep(gop_cache);
491 494
492 #ifdef SRS_AUTO_HLS 495 #ifdef SRS_AUTO_HLS
@@ -1177,8 +1180,7 @@ bool SrsSource::is_atc() @@ -1177,8 +1180,7 @@ bool SrsSource::is_atc()
1177 1180
1178 int SrsSource::on_edge_play_stream() 1181 int SrsSource::on_edge_play_stream()
1179 { 1182 {
1180 - int ret = ERROR_SUCCESS;  
1181 - return ret; 1183 + return edge->on_client_play();
1182 } 1184 }
1183 1185
1184 int SrsSource::create_forwarders() 1186 int SrsSource::create_forwarders()
@@ -37,6 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -37,6 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 #include <srs_app_st.hpp> 37 #include <srs_app_st.hpp>
38 #include <srs_app_reload.hpp> 38 #include <srs_app_reload.hpp>
39 39
  40 +class SrsEdge;
40 class SrsSource; 41 class SrsSource;
41 class SrsCommonMessage; 42 class SrsCommonMessage;
42 class SrsOnMetaDataPacket; 43 class SrsOnMetaDataPacket;
@@ -234,6 +235,8 @@ private: @@ -234,6 +235,8 @@ private:
234 #ifdef SRS_AUTO_TRANSCODE 235 #ifdef SRS_AUTO_TRANSCODE
235 SrsEncoder* encoder; 236 SrsEncoder* encoder;
236 #endif 237 #endif
  238 + // edge control service
  239 + SrsEdge* edge;
237 // gop cache for client fast startup. 240 // gop cache for client fast startup.
238 SrsGopCache* gop_cache; 241 SrsGopCache* gop_cache;
239 // to forward stream to other servers 242 // to forward stream to other servers