整理MediaSource派生类

修复转协议或录制时忽然Track的问题
This commit is contained in:
xiongziliang
2019-12-26 12:10:54 +08:00
parent 9e8fe8c86a
commit 453660ab79
7 changed files with 47 additions and 18 deletions

View File

@@ -29,6 +29,21 @@
namespace mediakit {
void RtmpDemuxer::loadMetaData(const AMFValue &val){
try {
makeVideoTrack(val["videocodecid"]);
makeAudioTrack(val["audiocodecid"]);
val.object_for_each([&](const string &key, const AMFValue &val) {
if (key == "duration") {
_fDuration = val.as_number();
return;
}
});
}catch (std::exception &ex){
WarnL << ex.what();
}
}
bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) {
switch (pkt->typeId) {
case MSG_VIDEO: {