mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
parent
5464313b41
commit
54194fe501
@ -536,7 +536,14 @@ void RtmpSession::onRtmpChunk(RtmpPacket::Ptr packet) {
|
||||
case MSG_AUDIO:
|
||||
case MSG_VIDEO: {
|
||||
if (!_push_src) {
|
||||
WarnL << "Not a rtmp push!";
|
||||
if (_ring_reader) {
|
||||
throw std::runtime_error("Rtmp player send media packets");
|
||||
}
|
||||
if (packet->isConfigFrame()) {
|
||||
auto id = packet->type_id;
|
||||
_push_config_packets.emplace(id, std::move(packet));
|
||||
}
|
||||
WarnL << "Rtmp pusher send media packet before handshake completed!";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -544,6 +551,12 @@ void RtmpSession::onRtmpChunk(RtmpPacket::Ptr packet) {
|
||||
_set_meta_data = true;
|
||||
_push_src->setMetaData(_push_metadata ? _push_metadata : TitleMeta().getMetadata());
|
||||
}
|
||||
if (!_push_config_packets.empty()) {
|
||||
for (auto &pr : _push_config_packets) {
|
||||
_push_src->onWrite(std::move(pr.second));
|
||||
}
|
||||
_push_config_packets.clear();
|
||||
}
|
||||
_push_src->onWrite(std::move(packet));
|
||||
break;
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ private:
|
||||
MediaInfo _media_info;
|
||||
std::weak_ptr<RtmpMediaSource> _play_src;
|
||||
AMFValue _push_metadata;
|
||||
std::map<uint8_t, RtmpPacket::Ptr> _push_config_packets;
|
||||
RtmpMediaSourceImp::Ptr _push_src;
|
||||
std::shared_ptr<void> _push_src_ownership;
|
||||
RtmpMediaSource::RingType::RingReader::Ptr _ring_reader;
|
||||
|
Loading…
Reference in New Issue
Block a user