mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-17 05:25:57 +08:00
完成Rtp解码器与Track之间的帧数据传递
This commit is contained in:
@@ -96,16 +96,28 @@ inline bool RtpParser::inputAudio(const RtpPacket::Ptr &rtp) {
|
||||
}
|
||||
|
||||
inline void RtpParser::onGetAudioTrack(const RtspTrack& audio) {
|
||||
//生成Track对象
|
||||
_audioTrack = dynamic_pointer_cast<AudioTrack>(Track::getTrackBySdp(audio.trackSdp));
|
||||
if(_audioTrack){
|
||||
//生成RtpCodec对象以便解码rtp
|
||||
_audioRtpDecoder = RtpCodec::getRtpDecoderById(_audioTrack->getCodecId(),_audioTrack->getAudioSampleRate());
|
||||
if(_audioRtpDecoder){
|
||||
//设置rtp解码器代理,生成的frame写入该Track
|
||||
_audioRtpDecoder->setDelegate(_audioTrack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void RtpParser::onGetVideoTrack(const RtspTrack& video) {
|
||||
//生成Track对象
|
||||
_videoTrack = dynamic_pointer_cast<VideoTrack>(Track::getTrackBySdp(video.trackSdp));
|
||||
if(_videoTrack){
|
||||
//生成RtpCodec对象以便解码rtp
|
||||
_videoRtpDecoder = RtpCodec::getRtpDecoderById(_videoTrack->getCodecId(),90000);
|
||||
if(_videoRtpDecoder){
|
||||
//设置rtp解码器代理,生成的frame写入该Track
|
||||
_videoRtpDecoder->setDelegate(_videoTrack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user