mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-06 20:23:43 +08:00
兼容不规范的rtmp推流器:#764
This commit is contained in:
parent
075756c4c6
commit
d2fec801c9
|
@ -415,17 +415,11 @@ void RtmpSession::onCmd_pause(AMFDecoder &dec) {
|
|||
}
|
||||
|
||||
void RtmpSession::setMetaData(AMFDecoder &dec) {
|
||||
if (!_publisher_src) {
|
||||
throw std::runtime_error("not a publisher");
|
||||
}
|
||||
std::string type = dec.load<std::string>();
|
||||
if (type != "onMetaData") {
|
||||
throw std::runtime_error("can only set metadata");
|
||||
}
|
||||
auto metadata = dec.load<AMFValue>();
|
||||
// dumpMetadata(metadata);
|
||||
_publisher_src->setMetaData(metadata);
|
||||
_set_meta_data = true;
|
||||
_publisher_metadata = dec.load<AMFValue>();
|
||||
}
|
||||
|
||||
void RtmpSession::onProcessCmd(AMFDecoder &dec) {
|
||||
|
@ -478,7 +472,8 @@ void RtmpSession::onRtmpChunk(RtmpPacket::Ptr packet) {
|
|||
case MSG_AUDIO:
|
||||
case MSG_VIDEO: {
|
||||
if (!_publisher_src) {
|
||||
throw std::runtime_error("Not a rtmp publisher!");
|
||||
WarnL << "Not a rtmp publisher!";
|
||||
return;
|
||||
}
|
||||
GET_CONFIG(bool, rtmp_modify_stamp, Rtmp::kModifyStamp);
|
||||
if (rtmp_modify_stamp) {
|
||||
|
@ -487,9 +482,9 @@ void RtmpSession::onRtmpChunk(RtmpPacket::Ptr packet) {
|
|||
chunk_data.time_stamp = (uint32_t)dts_out;
|
||||
}
|
||||
|
||||
if (!_set_meta_data && !chunk_data.isCfgFrame()) {
|
||||
if (!_set_meta_data) {
|
||||
_set_meta_data = true;
|
||||
_publisher_src->setMetaData(TitleMeta().getMetadata());
|
||||
_publisher_src->setMetaData(_publisher_metadata ? _publisher_metadata : TitleMeta().getMetadata());
|
||||
}
|
||||
_publisher_src->onWrite(std::move(packet));
|
||||
break;
|
||||
|
|
|
@ -98,8 +98,8 @@ private:
|
|||
//数据接收超时计时器
|
||||
Ticker _ticker;
|
||||
MediaInfo _media_info;
|
||||
|
||||
std::weak_ptr<RtmpMediaSource> _player_src;
|
||||
AMFValue _publisher_metadata;
|
||||
std::shared_ptr<RtmpMediaSourceImp> _publisher_src;
|
||||
RtmpMediaSource::RingType::RingReader::Ptr _ring_reader;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user