mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #98: workaround for librtmp ping(fmt=1,cid=2 fresh stream).
This commit is contained in:
parent
3f9c23d834
commit
f893711499
3 changed files with 19 additions and 5 deletions
|
@ -231,6 +231,7 @@ Supported operating systems and hardware:
|
|||
* 2013-10-17, Created.<br/>
|
||||
|
||||
## 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
|
||||
* <strong>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.</strong>
|
||||
* 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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue