rtmp拉流的兼容性改进 (#1595)

* 修复play指令的bug

* 修改MSG_AGGREGATE的时间戳处理逻辑

这里参考了ffmpeg的方式来计算时间戳.

* add bom
This commit is contained in:
alexliyu7352
2022-04-28 14:13:09 +08:00
committed by GitHub
parent c31d44d680
commit c1d2adebae
2 changed files with 12 additions and 3 deletions

View File

@@ -214,7 +214,7 @@ inline void RtmpPlayer::send_createStream() {
inline void RtmpPlayer::send_play() {
AMFEncoder enc;
enc << "play" << ++_send_req_id << nullptr << _stream_id << (double) _stream_index;
enc << "play" << ++_send_req_id << nullptr << _stream_id << "-2000";
sendRequest(MSG_CMD, enc.data());
auto fun = [](AMFValue &val) {
//TraceL << "play onStatus";
@@ -297,7 +297,8 @@ void RtmpPlayer::onCmd_onStatus(AMFDecoder &dec) {
auto level = val["level"];
auto code = val["code"].as_string();
if (level.type() == AMF_STRING) {
if (level.as_string() != "status") {
// warning 不应该断开
if (level.as_string() != "status" && level.as_string() != "warning") {
throw std::runtime_error(StrPrinter << "onStatus 失败:" << level.as_string() << " " << code << endl);
}
}