修复 mpeg extra data相关bug
This commit is contained in:
parent
02b296c85c
commit
b80601e020
|
|
@ -59,9 +59,9 @@ paced_sender_ms=0
|
||||||
#是否开启转换为hls(mpegts)
|
#是否开启转换为hls(mpegts)
|
||||||
enable_hls=1
|
enable_hls=1
|
||||||
#是否开启转换为hls(fmp4)
|
#是否开启转换为hls(fmp4)
|
||||||
enable_hls_fmp4=0
|
enable_hls_fmp4=1
|
||||||
#是否开启MP4录制
|
#是否开启MP4录制
|
||||||
enable_mp4=0
|
enable_mp4=1
|
||||||
#是否开启转换为rtsp/webrtc
|
#是否开启转换为rtsp/webrtc
|
||||||
enable_rtsp=1
|
enable_rtsp=1
|
||||||
#是否开启转换为rtmp/flv
|
#是否开启转换为rtmp/flv
|
||||||
|
|
@ -287,7 +287,7 @@ port=1935
|
||||||
#rtmps服务器监听地址
|
#rtmps服务器监听地址
|
||||||
sslport=0
|
sslport=0
|
||||||
# rtmp是否直接代理模式
|
# rtmp是否直接代理模式
|
||||||
directProxy=1
|
directProxy=0
|
||||||
#h265 rtmp打包采用增强型rtmp标准还是国内拓展标准
|
#h265 rtmp打包采用增强型rtmp标准还是国内拓展标准
|
||||||
enhanced=1
|
enhanced=1
|
||||||
|
|
||||||
|
|
@ -378,7 +378,7 @@ authBasic=0
|
||||||
#如果你是rtsp推拉流,但是webrtc播放,也建议关闭直接代理模式,
|
#如果你是rtsp推拉流,但是webrtc播放,也建议关闭直接代理模式,
|
||||||
#因为直接代理时,rtp中可能没有sps pps,会导致webrtc无法播放; 另外webrtc也不支持Single NAL Unit Packets类型rtp
|
#因为直接代理时,rtp中可能没有sps pps,会导致webrtc无法播放; 另外webrtc也不支持Single NAL Unit Packets类型rtp
|
||||||
#默认开启rtsp直接代理,rtmp由于没有这些问题,是强制开启直接代理的
|
#默认开启rtsp直接代理,rtmp由于没有这些问题,是强制开启直接代理的
|
||||||
directProxy=1
|
directProxy=0
|
||||||
#rtsp必须在此时间内完成握手,否则服务器会断开链接,单位秒
|
#rtsp必须在此时间内完成握手,否则服务器会断开链接,单位秒
|
||||||
handshakeSecond=15
|
handshakeSecond=15
|
||||||
#rtsp超时时间,如果该时间内未收到客户端的数据,
|
#rtsp超时时间,如果该时间内未收到客户端的数据,
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,7 @@ bool MpegMuxer::addTrack(const Track::Ptr &track) {
|
||||||
if (track->getTrackType() == TrackVideo) {
|
if (track->getTrackType() == TrackVideo) {
|
||||||
_have_video = true;
|
_have_video = true;
|
||||||
}
|
}
|
||||||
auto extra_data = track->getExtraData();
|
_codec_to_trackid[track->getCodecId()] = mpeg_muxer_add_stream((::mpeg_muxer_t *)_context, mpeg_id, nullptr, 0);
|
||||||
_codec_to_trackid[track->getCodecId()] = mpeg_muxer_add_stream((::mpeg_muxer_t *)_context, mpeg_id,
|
|
||||||
extra_data ? extra_data->data() : nullptr,
|
|
||||||
extra_data ? extra_data->size(): 0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,19 +66,16 @@ bool MpegMuxer::inputFrame(const Frame::Ptr &frame) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case CodecAAC: {
|
case CodecAAC: {
|
||||||
if (frame->prefixSize() == 0) {
|
CHECK(frame->prefixSize(), "Mpeg muxer required aac frame with adts heade");
|
||||||
WarnL << "必须提供adts头才能mpeg-ts打包";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
if (!_have_video) {
|
if (!_have_video) {
|
||||||
//没有视频时,才以音频时间戳为TS的时间戳
|
// 没有视频时,才以音频时间戳为TS的时间戳
|
||||||
_timestamp = frame->dts();
|
_timestamp = frame->dts();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frame->getTrackType() == TrackType::TrackVideo){
|
if (frame->getTrackType() == TrackType::TrackVideo) {
|
||||||
_key_pos = frame->keyFrame();
|
_key_pos = frame->keyFrame();
|
||||||
_timestamp = frame->dts();
|
_timestamp = frame->dts();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue