正在显示
9 个修改的文件
包含
32 行增加
和
8 行删除
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | SRS_WORKDIR="." | 7 | SRS_WORKDIR="." |
8 | SRS_OBJS_DIR="objs" | 8 | SRS_OBJS_DIR="objs" |
9 | SRS_OBJS="${SRS_WORKDIR}/${SRS_OBJS_DIR}" | 9 | SRS_OBJS="${SRS_WORKDIR}/${SRS_OBJS_DIR}" |
10 | -mkdir -p ${SRS_OBJS} | 10 | +SRS_MAKEFILE="Makefile" |
11 | 11 | ||
12 | # linux shell color support. | 12 | # linux shell color support. |
13 | RED="\\033[31m" | 13 | RED="\\033[31m" |
@@ -23,6 +23,9 @@ fi | @@ -23,6 +23,9 @@ fi | ||
23 | # remove makefile | 23 | # remove makefile |
24 | rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} | 24 | rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} |
25 | 25 | ||
26 | +# create objs | ||
27 | +mkdir -p ${SRS_OBJS} | ||
28 | + | ||
26 | ##################################################################################### | 29 | ##################################################################################### |
27 | # parse user options, set the variables like: | 30 | # parse user options, set the variables like: |
28 | # srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/...... | 31 | # srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/...... |
@@ -43,11 +46,9 @@ rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} | @@ -43,11 +46,9 @@ rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE} | ||
43 | ##################################################################################### | 46 | ##################################################################################### |
44 | # generate Makefile. | 47 | # generate Makefile. |
45 | ##################################################################################### | 48 | ##################################################################################### |
46 | -SRS_MAKEFILE="Makefile" | ||
47 | # ubuntu echo in Makefile cannot display color, use bash instead | 49 | # ubuntu echo in Makefile cannot display color, use bash instead |
48 | SRS_BUILD_SUMMARY="_srs_build_summary.sh" | 50 | SRS_BUILD_SUMMARY="_srs_build_summary.sh" |
49 | 51 | ||
50 | -##################################################################################### | ||
51 | # srs-librtmp sample entry | 52 | # srs-librtmp sample entry |
52 | SrsLibrtmpSampleEntry="nossl" | 53 | SrsLibrtmpSampleEntry="nossl" |
53 | if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi | 54 | if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi |
@@ -953,7 +953,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data) | @@ -953,7 +953,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data) | ||
953 | } | 953 | } |
954 | return ret; | 954 | return ret; |
955 | } | 955 | } |
956 | - srs_trace("http: read %d chunk", ilength); | 956 | + srs_info("http: read %d chunk", ilength); |
957 | 957 | ||
958 | // read payload when length specifies some payload. | 958 | // read payload when length specifies some payload. |
959 | if (ilength <= 0) { | 959 | if (ilength <= 0) { |
@@ -130,11 +130,13 @@ SrsMpegtsOverUdp::SrsMpegtsOverUdp(SrsConfDirective* c) | @@ -130,11 +130,13 @@ SrsMpegtsOverUdp::SrsMpegtsOverUdp(SrsConfDirective* c) | ||
130 | context = new SrsTsContext(); | 130 | context = new SrsTsContext(); |
131 | buffer = new SrsSimpleBuffer(); | 131 | buffer = new SrsSimpleBuffer(); |
132 | output = _srs_config->get_stream_caster_output(c); | 132 | output = _srs_config->get_stream_caster_output(c); |
133 | + | ||
133 | req = NULL; | 134 | req = NULL; |
134 | io = NULL; | 135 | io = NULL; |
135 | client = NULL; | 136 | client = NULL; |
136 | stfd = NULL; | 137 | stfd = NULL; |
137 | stream_id = 0; | 138 | stream_id = 0; |
139 | + | ||
138 | avc = new SrsRawH264Stream(); | 140 | avc = new SrsRawH264Stream(); |
139 | aac = new SrsRawAacStream(); | 141 | aac = new SrsRawAacStream(); |
140 | h264_sps_changed = false; | 142 | h264_sps_changed = false; |
@@ -159,8 +161,6 @@ SrsMpegtsOverUdp::~SrsMpegtsOverUdp() | @@ -159,8 +161,6 @@ SrsMpegtsOverUdp::~SrsMpegtsOverUdp() | ||
159 | 161 | ||
160 | int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf) | 162 | int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf) |
161 | { | 163 | { |
162 | - int ret = ERROR_SUCCESS; | ||
163 | - | ||
164 | std::string peer_ip = inet_ntoa(from->sin_addr); | 164 | std::string peer_ip = inet_ntoa(from->sin_addr); |
165 | int peer_port = ntohs(from->sin_port); | 165 | int peer_port = ntohs(from->sin_port); |
166 | 166 | ||
@@ -169,6 +169,13 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf) | @@ -169,6 +169,13 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf) | ||
169 | 169 | ||
170 | srs_info("udp: got %s:%d packet %d/%d bytes", | 170 | srs_info("udp: got %s:%d packet %d/%d bytes", |
171 | peer_ip.c_str(), peer_port, nb_buf, buffer->length()); | 171 | peer_ip.c_str(), peer_port, nb_buf, buffer->length()); |
172 | + | ||
173 | + return on_udp_bytes(peer_ip, peer_port, buf, nb_buf); | ||
174 | +} | ||
175 | + | ||
176 | +int SrsMpegtsOverUdp::on_udp_bytes(string host, int port, char* buf, int nb_buf) | ||
177 | +{ | ||
178 | + int ret = ERROR_SUCCESS; | ||
172 | 179 | ||
173 | // collect nMB data to parse in a time. | 180 | // collect nMB data to parse in a time. |
174 | // TODO: FIXME: comment the following for release. | 181 | // TODO: FIXME: comment the following for release. |
@@ -215,8 +222,7 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf) | @@ -215,8 +222,7 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf) | ||
215 | 222 | ||
216 | // drop ts packet when size not modulus by 188 | 223 | // drop ts packet when size not modulus by 188 |
217 | if (buffer->length() < SRS_TS_PACKET_SIZE) { | 224 | if (buffer->length() < SRS_TS_PACKET_SIZE) { |
218 | - srs_warn("udp: wait %s:%d packet %d/%d bytes", | ||
219 | - peer_ip.c_str(), peer_port, nb_buf, buffer->length()); | 225 | + srs_warn("udp: wait %s:%d packet %d/%d bytes", host.c_str(), port, nb_buf, buffer->length()); |
220 | return ret; | 226 | return ret; |
221 | } | 227 | } |
222 | 228 | ||
@@ -582,6 +588,7 @@ int SrsMpegtsOverUdp::connect() | @@ -582,6 +588,7 @@ int SrsMpegtsOverUdp::connect() | ||
582 | int ret = ERROR_SUCCESS; | 588 | int ret = ERROR_SUCCESS; |
583 | 589 | ||
584 | // when ok, ignore. | 590 | // when ok, ignore. |
591 | + // TODO: FIXME: should reconnect when disconnected. | ||
585 | if (io || client) { | 592 | if (io || client) { |
586 | return ret; | 593 | return ret; |
587 | } | 594 | } |
@@ -109,6 +109,8 @@ public: | @@ -109,6 +109,8 @@ public: | ||
109 | // interface ISrsUdpHandler | 109 | // interface ISrsUdpHandler |
110 | public: | 110 | public: |
111 | virtual int on_udp_packet(sockaddr_in* from, char* buf, int nb_buf); | 111 | virtual int on_udp_packet(sockaddr_in* from, char* buf, int nb_buf); |
112 | +private: | ||
113 | + virtual int on_udp_bytes(std::string host, int port, char* buf, int nb_buf); | ||
112 | // interface ISrsTsHandler | 114 | // interface ISrsTsHandler |
113 | public: | 115 | public: |
114 | virtual int on_ts_message(SrsTsMessage* msg); | 116 | virtual int on_ts_message(SrsTsMessage* msg); |
@@ -247,6 +247,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -247,6 +247,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
247 | #define ERROR_HTTP_RESPONSE_EOF 4025 | 247 | #define ERROR_HTTP_RESPONSE_EOF 4025 |
248 | #define ERROR_HTTP_INVALID_CHUNK_HEADER 4026 | 248 | #define ERROR_HTTP_INVALID_CHUNK_HEADER 4026 |
249 | 249 | ||
250 | +/////////////////////////////////////////////////////// | ||
251 | +// user-define error. | ||
252 | +/////////////////////////////////////////////////////// | ||
253 | +#define ERROR_USER_START 9000 | ||
254 | +#define ERROR_USER_END 9999 | ||
255 | + | ||
250 | /** | 256 | /** |
251 | * whether the error code is an system control error. | 257 | * whether the error code is an system control error. |
252 | */ | 258 | */ |
@@ -82,6 +82,7 @@ public: | @@ -82,6 +82,7 @@ public: | ||
82 | virtual int open(std::string file); | 82 | virtual int open(std::string file); |
83 | virtual void close(); | 83 | virtual void close(); |
84 | public: | 84 | public: |
85 | + // TODO: FIXME: extract interface. | ||
85 | virtual bool is_open(); | 86 | virtual bool is_open(); |
86 | virtual int64_t tellg(); | 87 | virtual int64_t tellg(); |
87 | virtual void skip(int64_t size); | 88 | virtual void skip(int64_t size); |
@@ -206,6 +206,11 @@ void check_macro_features() | @@ -206,6 +206,11 @@ void check_macro_features() | ||
206 | srs_warn("SRS %s is develop branch, please use %s instead", RTMP_SIG_SRS_VERSION, RTMP_SIG_SRS_RELEASE); | 206 | srs_warn("SRS %s is develop branch, please use %s instead", RTMP_SIG_SRS_VERSION, RTMP_SIG_SRS_RELEASE); |
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | +#if defined(SRS_AUTO_STREAM_CASTER) | ||
210 | + #warning "stream caster is experiment feature." | ||
211 | + srs_warn("stream caster is experiment feature."); | ||
212 | +#endif | ||
213 | + | ||
209 | #if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF) | 214 | #if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF) |
210 | #error "SRS_PERF_SO_SNDBUF_SIZE depends on SRS_PERF_MW_SO_SNDBUF" | 215 | #error "SRS_PERF_SO_SNDBUF_SIZE depends on SRS_PERF_MW_SO_SNDBUF" |
211 | #endif | 216 | #endif |
-
请 注册 或 登录 后发表评论