winlin

add tools

  1 +#!/bin/bash
  2 +
  3 +# check exists.
  4 +if [[ -f /usr/local/bin/ccache ]]; then
  5 + echo "ccache is ok";
  6 + exit 0;
  7 +fi
  8 +
  9 +# check sudoer.
  10 +sudo echo "ok" > /dev/null 2>&1;
  11 +ret=$?; if [[ 0 -ne ${ret} ]]; then echo "you must be sudoer"; exit 1; fi
  12 +
  13 +unzip ccache-3.1.9.zip && cd ccache-3.1.9 && ./configure && make
  14 +ret=$?; if [[ $ret -ne 0 ]]; then echo "build ccache failed."; exit $ret; fi
  15 +
  16 +sudo cp ccache /usr/local/bin && sudo ln -s ccache /usr/local/bin/gcc && sudo ln -s ccache /usr/local/bin/g++ && sudo ln -s ccache /usr/local/bin/cc && sudo ln -s ccache /usr/local/bin/c++
  17 +ret=$?; if [[ $ret -ne 0 ]]; then echo "install ccache failed."; exit $ret; fi
不能预览此文件类型
@@ -364,12 +364,23 @@ SrsSource::SrsSource(std::string _stream_url) @@ -364,12 +364,23 @@ SrsSource::SrsSource(std::string _stream_url)
364 364
365 SrsSource::~SrsSource() 365 SrsSource::~SrsSource()
366 { 366 {
  367 + if (true) {
367 std::vector<SrsConsumer*>::iterator it; 368 std::vector<SrsConsumer*>::iterator it;
368 for (it = consumers.begin(); it != consumers.end(); ++it) { 369 for (it = consumers.begin(); it != consumers.end(); ++it) {
369 SrsConsumer* consumer = *it; 370 SrsConsumer* consumer = *it;
370 srs_freep(consumer); 371 srs_freep(consumer);
371 } 372 }
372 consumers.clear(); 373 consumers.clear();
  374 + }
  375 +
  376 + if (true) {
  377 + std::vector<SrsForwarder*>::iterator it;
  378 + for (it = forwarders.begin(); it != forwarders.end(); ++it) {
  379 + SrsForwarder* forwarder = *it;
  380 + srs_freep(forwarder);
  381 + }
  382 + forwarders.clear();
  383 + }
373 384
374 srs_freep(cache_metadata); 385 srs_freep(cache_metadata);
375 srs_freep(cache_sh_video); 386 srs_freep(cache_sh_video);
@@ -166,14 +166,16 @@ public: @@ -166,14 +166,16 @@ public:
166 static SrsSource* find(std::string stream_url); 166 static SrsSource* find(std::string stream_url);
167 private: 167 private:
168 std::string stream_url; 168 std::string stream_url;
  169 + // to delivery stream to clients.
169 std::vector<SrsConsumer*> consumers; 170 std::vector<SrsConsumer*> consumers;
170 -private:  
171 // hls handler. 171 // hls handler.
172 #ifdef SRS_HLS 172 #ifdef SRS_HLS
173 SrsHls* hls; 173 SrsHls* hls;
174 #endif 174 #endif
175 // gop cache for client fast startup. 175 // gop cache for client fast startup.
176 SrsGopCache* gop_cache; 176 SrsGopCache* gop_cache;
  177 + // to forward stream to other servers
  178 + std::vector<SrsForwarder*> forwarders;
177 private: 179 private:
178 /** 180 /**
179 * the sample rate of audio in metadata. 181 * the sample rate of audio in metadata.