修复rtmp解复用器可能丢失config帧的bug

This commit is contained in:
xiongziliang 2019-03-01 18:47:58 +08:00
parent db261260ff
commit 0808cdee4b

View File

@ -52,27 +52,27 @@ int RtmpDemuxer::getTrackCount(const AMFValue &metedata) {
bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) { bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) {
switch (pkt->typeId) { switch (pkt->typeId) {
case MSG_VIDEO: { case MSG_VIDEO: {
if(_videoRtmpDecoder){
return _videoRtmpDecoder->inputRtmp(pkt, true);
}
if(!_tryedGetVideoTrack){ if(!_tryedGetVideoTrack){
_tryedGetVideoTrack = true; _tryedGetVideoTrack = true;
auto codec = AMFValue(pkt->getMediaType()); auto codec = AMFValue(pkt->getMediaType());
makeVideoTrack(codec); makeVideoTrack(codec);
} }
if(_videoRtmpDecoder){
return _videoRtmpDecoder->inputRtmp(pkt, true);
}
return false; return false;
} }
case MSG_AUDIO: { case MSG_AUDIO: {
if(_audioRtmpDecoder){
_audioRtmpDecoder->inputRtmp(pkt, false);
return false;
}
if(!_tryedGetAudioTrack) { if(!_tryedGetAudioTrack) {
_tryedGetAudioTrack = true; _tryedGetAudioTrack = true;
auto codec = AMFValue(pkt->getMediaType()); auto codec = AMFValue(pkt->getMediaType());
makeAudioTrack(codec); makeAudioTrack(codec);
} }
if(_audioRtmpDecoder){
_audioRtmpDecoder->inputRtmp(pkt, false);
return false;
}
return false; return false;
} }
default: default: