winlin

fix configure bug, refine code for stream caster.

... ... @@ -7,7 +7,7 @@
SRS_WORKDIR="."
SRS_OBJS_DIR="objs"
SRS_OBJS="${SRS_WORKDIR}/${SRS_OBJS_DIR}"
mkdir -p ${SRS_OBJS}
SRS_MAKEFILE="Makefile"
# linux shell color support.
RED="\\033[31m"
... ... @@ -23,6 +23,9 @@ fi
# remove makefile
rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}
# create objs
mkdir -p ${SRS_OBJS}
#####################################################################################
# parse user options, set the variables like:
# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/......
... ... @@ -43,11 +46,9 @@ rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}
#####################################################################################
# generate Makefile.
#####################################################################################
SRS_MAKEFILE="Makefile"
# ubuntu echo in Makefile cannot display color, use bash instead
SRS_BUILD_SUMMARY="_srs_build_summary.sh"
#####################################################################################
# srs-librtmp sample entry
SrsLibrtmpSampleEntry="nossl"
if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi
... ...
... ... @@ -1101,3 +1101,4 @@ bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b);
extern SrsConfig* _srs_config;
#endif
... ...
... ... @@ -953,7 +953,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data)
}
return ret;
}
srs_trace("http: read %d chunk", ilength);
srs_info("http: read %d chunk", ilength);
// read payload when length specifies some payload.
if (ilength <= 0) {
... ...
... ... @@ -130,11 +130,13 @@ SrsMpegtsOverUdp::SrsMpegtsOverUdp(SrsConfDirective* c)
context = new SrsTsContext();
buffer = new SrsSimpleBuffer();
output = _srs_config->get_stream_caster_output(c);
req = NULL;
io = NULL;
client = NULL;
stfd = NULL;
stream_id = 0;
avc = new SrsRawH264Stream();
aac = new SrsRawAacStream();
h264_sps_changed = false;
... ... @@ -159,8 +161,6 @@ SrsMpegtsOverUdp::~SrsMpegtsOverUdp()
int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf)
{
int ret = ERROR_SUCCESS;
std::string peer_ip = inet_ntoa(from->sin_addr);
int peer_port = ntohs(from->sin_port);
... ... @@ -169,6 +169,13 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf)
srs_info("udp: got %s:%d packet %d/%d bytes",
peer_ip.c_str(), peer_port, nb_buf, buffer->length());
return on_udp_bytes(peer_ip, peer_port, buf, nb_buf);
}
int SrsMpegtsOverUdp::on_udp_bytes(string host, int port, char* buf, int nb_buf)
{
int ret = ERROR_SUCCESS;
// collect nMB data to parse in a time.
// TODO: FIXME: comment the following for release.
... ... @@ -215,8 +222,7 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf)
// drop ts packet when size not modulus by 188
if (buffer->length() < SRS_TS_PACKET_SIZE) {
srs_warn("udp: wait %s:%d packet %d/%d bytes",
peer_ip.c_str(), peer_port, nb_buf, buffer->length());
srs_warn("udp: wait %s:%d packet %d/%d bytes", host.c_str(), port, nb_buf, buffer->length());
return ret;
}
... ... @@ -582,6 +588,7 @@ int SrsMpegtsOverUdp::connect()
int ret = ERROR_SUCCESS;
// when ok, ignore.
// TODO: FIXME: should reconnect when disconnected.
if (io || client) {
return ret;
}
... ...
... ... @@ -109,6 +109,8 @@ public:
// interface ISrsUdpHandler
public:
virtual int on_udp_packet(sockaddr_in* from, char* buf, int nb_buf);
private:
virtual int on_udp_bytes(std::string host, int port, char* buf, int nb_buf);
// interface ISrsTsHandler
public:
virtual int on_ts_message(SrsTsMessage* msg);
... ...
... ... @@ -310,3 +310,4 @@ public:
};
#endif
... ...
... ... @@ -247,6 +247,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_HTTP_RESPONSE_EOF 4025
#define ERROR_HTTP_INVALID_CHUNK_HEADER 4026
///////////////////////////////////////////////////////
// user-define error.
///////////////////////////////////////////////////////
#define ERROR_USER_START 9000
#define ERROR_USER_END 9999
/**
* whether the error code is an system control error.
*/
... ...
... ... @@ -82,6 +82,7 @@ public:
virtual int open(std::string file);
virtual void close();
public:
// TODO: FIXME: extract interface.
virtual bool is_open();
virtual int64_t tellg();
virtual void skip(int64_t size);
... ...
... ... @@ -206,6 +206,11 @@ void check_macro_features()
srs_warn("SRS %s is develop branch, please use %s instead", RTMP_SIG_SRS_VERSION, RTMP_SIG_SRS_RELEASE);
#endif
#if defined(SRS_AUTO_STREAM_CASTER)
#warning "stream caster is experiment feature."
srs_warn("stream caster is experiment feature.");
#endif
#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF)
#error "SRS_PERF_SO_SNDBUF_SIZE depends on SRS_PERF_MW_SO_SNDBUF"
#endif
... ...