mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
Merge remote-tracking branch 'origin/master' into zqsong
This commit is contained in:
commit
36803ccedc
@ -63,7 +63,7 @@
|
||||
| RTMP --> RTSP[S] | Y | N | Y | N |
|
||||
| RTSP[S] --> HLS | Y | Y | Y | N |
|
||||
| RTMP --> HLS | Y | N | Y | N |
|
||||
| RTSP[S] --> MP4 | Y | N | Y | N |
|
||||
| RTSP[S] --> MP4 | Y | Y | Y | N |
|
||||
| RTMP --> MP4 | Y | N | Y | N |
|
||||
| MP4 --> RTSP[S] | Y | N | Y | N |
|
||||
| MP4 --> RTMP | Y | N | Y | N |
|
||||
@ -73,9 +73,9 @@
|
||||
| feature/codec | H264 | H265 | AAC | other |
|
||||
| :-----------: | :--: | :--: | :--: | :---: |
|
||||
| RTSP[S] push | Y | Y | Y | Y |
|
||||
| RTSP proxy | Y | Y | Y | N |
|
||||
| RTSP proxy | Y | Y | Y | Y |
|
||||
| RTMP push | Y | Y | Y | Y |
|
||||
| RTMP proxy | Y | N | Y | N |
|
||||
| RTMP proxy | Y | Y | Y | Y |
|
||||
|
||||
- RTP transport:
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
| RTMP --> RTSP[S] | Y | N | Y | N |
|
||||
| RTSP[S] --> HLS | Y | Y | Y | N |
|
||||
| RTMP --> HLS | Y | N | Y | N |
|
||||
| RTSP[S] --> MP4 | Y | N | Y | N |
|
||||
| RTSP[S] --> MP4 | Y | Y | Y | N |
|
||||
| RTMP --> MP4 | Y | N | Y | N |
|
||||
| MP4 --> RTSP[S] | Y | N | Y | N |
|
||||
| MP4 --> RTMP | Y | N | Y | N |
|
||||
@ -88,9 +88,9 @@
|
||||
| 功能/编码格式 | H264 | H265 | AAC | other |
|
||||
| :------------------------------: | :--: | :--: | :--: | :---: |
|
||||
| RTSP[S]推流 | Y | Y | Y | Y |
|
||||
| RTSP拉流代理 | Y | Y | Y | N |
|
||||
| RTSP拉流代理 | Y | Y | Y | Y |
|
||||
| RTMP推流 | Y | Y | Y | Y |
|
||||
| RTMP拉流代理 | Y | N | Y | N |
|
||||
| RTMP拉流代理 | Y | Y | Y | Y |
|
||||
|
||||
- RTP传输方式:
|
||||
|
||||
|
@ -41,7 +41,7 @@ void MediaSink::addTrack(const Track::Ptr &track_in) {
|
||||
if(!strongSelf){
|
||||
return;
|
||||
}
|
||||
if(strongSelf->_allTrackReady){
|
||||
if(!strongSelf->_anyTrackUnReady){
|
||||
strongSelf->onTrackFrame(frame);
|
||||
}
|
||||
}));
|
||||
@ -53,6 +53,7 @@ void MediaSink::addTrack(const Track::Ptr &track_in) {
|
||||
if(track->ready()){
|
||||
lam();
|
||||
}else{
|
||||
_anyTrackUnReady = true;
|
||||
_allTrackReady = false;
|
||||
_trackReadyCallback[codec_id] = lam;
|
||||
_ticker.resetTime();
|
||||
@ -79,7 +80,7 @@ void MediaSink::inputFrame(const Frame::Ptr &frame) {
|
||||
|
||||
if(!_allTrackReady && (_trackReadyCallback.empty() || _ticker.elapsedTime() > MAX_WAIT_MS)){
|
||||
_allTrackReady = true;
|
||||
|
||||
_anyTrackUnReady = false;
|
||||
if(!_trackReadyCallback.empty()){
|
||||
//这是超时强制忽略未准备好的Track
|
||||
_trackReadyCallback.clear();
|
||||
|
@ -99,6 +99,7 @@ private:
|
||||
map<int,Track::Ptr> _track_map;
|
||||
map<int,function<void()> > _trackReadyCallback;
|
||||
bool _allTrackReady = false;
|
||||
bool _anyTrackUnReady = false;
|
||||
Ticker _ticker;
|
||||
};
|
||||
|
||||
|
@ -79,6 +79,16 @@ void MP4Muxer::onTrackFrame(const Frame::Ptr &frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!_started){
|
||||
//还没开始
|
||||
if(frame->getTrackType() != TrackVideo || !frame->keyFrame()){
|
||||
//如果首帧是音频或者是视频但是不是i帧,那么不能开始写文件
|
||||
return;
|
||||
}
|
||||
//开始写文件
|
||||
_started = true;
|
||||
}
|
||||
|
||||
int with_nalu_size ;
|
||||
switch (frame->getCodecId()){
|
||||
case CodecH264:
|
||||
|
@ -80,6 +80,7 @@ private:
|
||||
uint32_t start_pts = 0;
|
||||
};
|
||||
map<CodecId,track_info> _codec_to_trackid;
|
||||
bool _started = false;
|
||||
};
|
||||
|
||||
|
||||
|
@ -89,10 +89,8 @@ void Mp4Maker::createFile() {
|
||||
try {
|
||||
_muxer = std::make_shared<MP4MuxerFile>(strFileTmp.data());
|
||||
for(auto &track :_tracks){
|
||||
if(track){
|
||||
//添加track
|
||||
_muxer->addTrack(track);
|
||||
}
|
||||
//添加track
|
||||
_muxer->addTrack(track);
|
||||
}
|
||||
_strFileTmp = strFileTmp;
|
||||
_strFile = strFile;
|
||||
|
@ -258,7 +258,7 @@ int main(int argc,char *argv[]) {
|
||||
//rtsp://127.0.0.1/record/live/0/2017-04-11/11-09-38.mp4
|
||||
//rtmp://127.0.0.1/record/live/0/2017-04-11/11-09-38.mp4
|
||||
|
||||
PlayerProxy::Ptr player(new PlayerProxy(DEFAULT_VHOST, "live", to_string(i).data(),false,false,false,true));
|
||||
PlayerProxy::Ptr player(new PlayerProxy(DEFAULT_VHOST, "live", to_string(i).data()));
|
||||
//指定RTP over TCP(播放rtsp时有效)
|
||||
(*player)[kRtpType] = Rtsp::RTP_TCP;
|
||||
//开始播放,如果播放失败或者播放中止,将会自动重试若干次,重试次数在配置文件中配置,默认一直重试
|
||||
|
Loading…
Reference in New Issue
Block a user