Merge from SRS2, for

pull/854/head
winlin
commit 33375db401

@ -214,6 +214,7 @@ Please select your language:
### V2 changes
* v2.0, 2017-04-09, Fix [#834][bug #834], crash for TS context corrupt. 2.0.235
* <strong>v2.0, 2017-03-03, [2.0 release0(2.0.234)][r2.0r0] released. 86373 lines.</strong>
* v2.0, 2017-02-25, for [#730][bug #730], remove the test code. 2.0.234
* v2.0, 2017-02-09, fix [#503][bug #503] disable utilities when reload a source. 2.0.233
@ -1383,6 +1384,7 @@ Winlin
[bug #750]: https://github.com/ossrs/srs/issues/750
[bug #752]: https://github.com/ossrs/srs/issues/752
[bug #503]: https://github.com/ossrs/srs/issues/503
[bug #834]: https://github.com/ossrs/srs/issues/834
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
[bug #735]: https://github.com/ossrs/srs/issues/735

@ -42,7 +42,7 @@ else
echo "build fdk-aac-0.1.3"
cd $ff_current_dir &&
rm -rf fdk-aac-0.1.3 && unzip -q ${ff_src_dir}/fdk-aac-0.1.3.zip &&
cd fdk-aac-0.1.3 && bash autogen.sh && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install &&
cd fdk-aac-0.1.3 && bash autogen.sh && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build fdk-aac-0.1.3 failed"; exit 1; fi
fi

@ -521,6 +521,14 @@ int SrsRtmpConn::stream_service_cycle()
}
srs_info("security check ok");
// Never allow the empty stream name, for HLS may write to a file with empty name.
// @see https://github.com/ossrs/srs/issues/834
if (req->stream.empty()) {
ret = ERROR_RTMP_STREAM_NAME_EMPTY;
srs_error("RTMP: Empty stream name not allowed, ret=%d", ret);
return ret;
}
// client is identified, set the timeout to service timeout.
rtmp->set_recv_timeout(SRS_CONSTS_RTMP_TMMS);
rtmp->set_send_timeout(SRS_CONSTS_RTMP_TMMS);

@ -158,7 +158,8 @@
#define ERROR_RTMP_STREAM_NOT_FOUND 2048
#define ERROR_RTMP_CLIENT_NOT_FOUND 2049
#define ERROR_OpenSslCreateHMAC 2050
//
#define ERROR_RTMP_STREAM_NAME_EMPTY 2051
//
// system control message,
// not an error, but special control logic.
//
@ -260,6 +261,7 @@
#define ERROR_MP4_AVCC_CHANGE 3085
#define ERROR_MP4_ASC_CHANGE 3086
#define ERROR_DASH_WRITE_FAILED 3087
#define ERROR_TS_CONTEXT_NOT_READY 3088
///////////////////////////////////////////////////////
// HTTP/StreamCaster/KAFKA protocol error.

@ -199,6 +199,7 @@ ISrsTsHandler::~ISrsTsHandler()
SrsTsContext::SrsTsContext()
{
ready = false;
pure_audio = false;
sync_byte = 0x47; // ts default sync byte.
vcodec = SrsVideoCodecIdReserved;
@ -235,6 +236,7 @@ void SrsTsContext::on_pmt_parsed()
void SrsTsContext::reset()
{
ready = false;
vcodec = SrsVideoCodecIdReserved;
acodec = SrsAudioCodecIdReserved1;
}
@ -443,6 +445,9 @@ int SrsTsContext::encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStrea
}
}
// When PAT and PMT are writen, the context is ready now.
ready = true;
return ret;
}
@ -450,6 +455,13 @@ int SrsTsContext::encode_pes(SrsFileWriter* writer, SrsTsMessage* msg, int16_t p
{
int ret = ERROR_SUCCESS;
// Sometimes, the context is not ready(PAT/PMT write failed), error in this situation.
if (!ready) {
ret = ERROR_TS_CONTEXT_NOT_READY;
srs_error("TS: context not ready, ret=%d", ret);
return ret;
}
if (msg->payload->length() == 0) {
return ret;
}

@ -342,7 +342,12 @@ public:
*/
class SrsTsContext
{
// codec
private:
// Whether context is ready, failed if try to write data when not ready.
// When PAT and PMT writen, the context is ready.
// @see https://github.com/ossrs/srs/issues/834
bool ready;
// codec
private:
std::map<int, SrsTsChannel*> pids;
bool pure_audio;

Loading…
Cancel
Save