diff --git a/README.md b/README.md index f4b46e427..492af4a6d 100755 --- a/README.md +++ b/README.md @@ -231,6 +231,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* v1.0, 2014-06-14, fix [#98](https://github.com/winlinvip/simple-rtmp-server/issues/98), workaround for librtmp ping(fmt=1,cid=2 fresh stream). 0.9.124 * v1.0, 2014-05-29, support flv inject and flv http streaming with start=bytes. 0.9.122 * v1.0, 2014-05-28, [1.0 mainline4(0.9.120)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline4) released. 39200 lines. * v1.0, 2014-05-27, fix [#87](https://github.com/winlinvip/simple-rtmp-server/issues/87), add source id for full trackable log. 0.9.120 diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 70535c050..6ad759e83 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR "0" #define VERSION_MINOR "9" -#define VERSION_REVISION "123" +#define VERSION_REVISION "124" #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION // server info. #define RTMP_SIG_SRS_KEY "SRS" diff --git a/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp b/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp index 76050b95f..f5a2cdef2 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp +++ b/trunk/src/rtmp/srs_protocol_rtmp_stack.cpp @@ -954,10 +954,23 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz // but, we can ensure that when a chunk stream is fresh, // the fmt must be 0, a new stream. if (chunk->msg_count == 0 && fmt != RTMP_FMT_TYPE0) { - ret = ERROR_RTMP_CHUNK_START; - srs_error("chunk stream is fresh, fmt must be %d, actual is %d. cid=%d, ret=%d", - RTMP_FMT_TYPE0, fmt, chunk->cid, ret); - return ret; + // for librtmp, if ping, it will send a fresh stream with fmt=1, + // 0x42 where: fmt=1, cid=2, protocol contorl user-control message + // 0x00 0x00 0x00 where: timestamp=0 + // 0x00 0x00 0x06 where: payload_length=6 + // 0x04 where: message_type=4(protocol control user-control message) + // 0x00 0x06 where: event Ping(0x06) + // 0x00 0x00 0x0d 0x0f where: event data 4bytes ping timestamp. + // @see: https://github.com/winlinvip/simple-rtmp-server/issues/98 + if (chunk->cid == RTMP_CID_ProtocolControl && fmt == RTMP_FMT_TYPE1) { + srs_warn("accept cid=2, fmt=1 to make librtmp happy."); + } else { + // must be a RTMP protocol level error. + ret = ERROR_RTMP_CHUNK_START; + srs_error("chunk stream is fresh, fmt must be %d, actual is %d. cid=%d, ret=%d", + RTMP_FMT_TYPE0, fmt, chunk->cid, ret); + return ret; + } } // when exists cache msg, means got an partial message,