mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
注释,说明
注释,说明
This commit is contained in:
parent
e3139134e8
commit
036b36f012
@ -70,7 +70,7 @@ void MediaSink::inputFrame(const Frame::Ptr &frame) {
|
||||
it->second->inputFrame(frame);
|
||||
|
||||
if(!_allTrackReady && !_trackReadyCallback.empty() && it->second->ready()){
|
||||
//Track由未就绪状态装换成就绪状态,我们就触发onTrackReady回调
|
||||
//Track由未就绪状态转换成就绪状态,我们就触发onTrackReady回调
|
||||
auto it_callback = _trackReadyCallback.find(codec_id);
|
||||
if(it_callback != _trackReadyCallback.end()){
|
||||
it_callback->second();
|
||||
|
@ -123,6 +123,7 @@ MediaSource::Ptr MediaSource::find(
|
||||
|
||||
lock_guard<recursive_mutex> lock(g_mtxMediaSrc);
|
||||
MediaSource::Ptr ret;
|
||||
//查找某一媒体源,找到后返回
|
||||
searchMedia(schema, vhost, app, id,
|
||||
[&](SchemaVhostAppStreamMap::iterator &it0 ,
|
||||
VhostAppStreamMap::iterator &it1,
|
||||
@ -138,7 +139,7 @@ MediaSource::Ptr MediaSource::find(
|
||||
return true;
|
||||
});
|
||||
if(!ret && bMake){
|
||||
//查找某一媒体源,找到后返回
|
||||
//未查找媒体源,则创建一个
|
||||
ret = MediaReader::onMakeMediaSource(schema, vhost,app,id);
|
||||
}
|
||||
return ret;
|
||||
|
@ -48,7 +48,7 @@ string makeAdtsConfig(const uint8_t *pcAdts);
|
||||
void getAACInfo(const AACFrame &adts,int &iSampleRate,int &iChannel);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* aac帧,包含adts头
|
||||
*/
|
||||
class AACFrame : public Frame {
|
||||
|
@ -36,6 +36,7 @@ using namespace toolkit;
|
||||
namespace mediakit{
|
||||
/**
|
||||
* h264 Rtmp解码类
|
||||
* 将 h264 over rtmp 解复用出 h264-Frame
|
||||
*/
|
||||
class H264RtmpDecoder : public RtmpCodec ,public ResourcePoolHelper<H264Frame> {
|
||||
public:
|
||||
|
@ -90,7 +90,24 @@ bool H264RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
* Type==7:SPS frame
|
||||
* Type==8:PPS frame
|
||||
*/
|
||||
/*
|
||||
RTF3984 5.2节 Common Structure of the RTP Payload Format
|
||||
Table 1. Summary of NAL unit types and their payload structures
|
||||
|
||||
Type Packet Type name Section
|
||||
---------------------------------------------------------
|
||||
0 undefined -
|
||||
1-23 NAL unit Single NAL unit packet per H.264 5.6
|
||||
24 STAP-A Single-time aggregation packet 5.7.1
|
||||
25 STAP-B Single-time aggregation packet 5.7.1
|
||||
26 MTAP16 Multi-time aggregation packet 5.7.2
|
||||
27 MTAP24 Multi-time aggregation packet 5.7.2
|
||||
28 FU-A Fragmentation unit 5.8
|
||||
29 FU-B Fragmentation unit 5.8
|
||||
30-31 undefined -
|
||||
|
||||
|
||||
*/
|
||||
const uint8_t *frame = (uint8_t *) rtppack->data() + rtppack->offset;
|
||||
int length = rtppack->size() - rtppack->offset;
|
||||
NALU nal;
|
||||
@ -145,7 +162,7 @@ bool H264RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
FU fu;
|
||||
MakeFU(frame[1], fu);
|
||||
if (fu.S) {
|
||||
//该帧的第一个rtp包
|
||||
//该帧的第一个rtp包 FU-A start
|
||||
char tmp = (nal.forbidden_zero_bit << 7 | nal.nal_ref_idc << 5 | fu.type);
|
||||
_h264frame->buffer.assign("\x0\x0\x0\x1", 4);
|
||||
_h264frame->buffer.push_back(tmp);
|
||||
@ -164,14 +181,14 @@ bool H264RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
|
||||
}
|
||||
|
||||
if (!fu.E) {
|
||||
//该帧的中间rtp包
|
||||
//该帧的中间rtp包 FU-A mid
|
||||
_h264frame->buffer.append((char *)frame + 2, length - 2);
|
||||
//该函数return时,保存下当前sequence,以便下次对比seq是否连续
|
||||
_lastSeq = rtppack->sequence;
|
||||
return false;
|
||||
}
|
||||
|
||||
//该帧最后一个rtp包
|
||||
//该帧最后一个rtp包 FU-A end
|
||||
_h264frame->buffer.append((char *)frame + 2, length - 2);
|
||||
_h264frame->timeStamp = rtppack->timeStamp;
|
||||
auto key = _h264frame->keyFrame();
|
||||
|
@ -36,6 +36,8 @@ namespace mediakit{
|
||||
|
||||
/**
|
||||
* h264 rtp解码类
|
||||
* 将 h264 over rtsp-rtp 解复用出 h264-Frame
|
||||
* rfc3984
|
||||
*/
|
||||
class H264RtpDecoder : public RtpCodec , public ResourcePoolHelper<H264Frame> {
|
||||
public:
|
||||
|
@ -37,6 +37,8 @@ namespace mediakit{
|
||||
|
||||
/**
|
||||
* h265 rtp解码类
|
||||
* 将 h265 over rtsp-rtp 解复用出 h265-Frame
|
||||
* 《草案(H265-over-RTP)draft-ietf-payload-rtp-h265-07.pdf》
|
||||
*/
|
||||
class H265RtpDecoder : public RtpCodec , public ResourcePoolHelper<H265Frame> {
|
||||
public:
|
||||
|
@ -490,6 +490,7 @@ inline void HttpSession::Handle_Req_GET(int64_t &content_len) {
|
||||
|
||||
//再看看是否为http-flv直播请求
|
||||
if(checkLiveFlvStream()){
|
||||
//若是,return!
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ using namespace toolkit;
|
||||
using namespace mediakit::Client;
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
//实现了rtmp播放器协议部分的功能,及数据接收功能
|
||||
class RtmpPlayer:public PlayerBase, public TcpClient, public RtmpProtocol{
|
||||
public:
|
||||
typedef std::shared_ptr<RtmpPlayer> Ptr;
|
||||
@ -63,11 +63,11 @@ protected:
|
||||
void onMediaData_l(const RtmpPacket::Ptr &chunkData);
|
||||
void onPlayResult_l(const SockException &ex);
|
||||
|
||||
//for Tcpclient
|
||||
//form Tcpclient
|
||||
void onRecv(const Buffer::Ptr &pBuf) override;
|
||||
void onConnect(const SockException &err) override;
|
||||
void onErr(const SockException &ex) override;
|
||||
//fro RtmpProtocol
|
||||
//from RtmpProtocol
|
||||
void onRtmpChunk(RtmpPacket &chunkData) override;
|
||||
void onStreamDry(uint32_t ui32StreamId) override;
|
||||
void onSendRawData(const Buffer::Ptr &buffer) override{
|
||||
|
@ -39,7 +39,7 @@ RtspMuxer::RtspMuxer(const TitleSdp::Ptr &title){
|
||||
}
|
||||
|
||||
void RtspMuxer::onTrackReady(const Track::Ptr &track) {
|
||||
//根据track生产sdp
|
||||
//根据track生成sdp
|
||||
Sdp::Ptr sdp = track->getSdp();
|
||||
if (!sdp) {
|
||||
return;
|
||||
|
@ -46,7 +46,7 @@ using namespace toolkit;
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
//实现了rtsp播放器协议部分的功能
|
||||
//实现了rtsp播放器协议部分的功能,及数据接收功能
|
||||
class RtspPlayer: public PlayerBase,public TcpClient, public RtspSplitter, public RtpReceiver {
|
||||
public:
|
||||
typedef std::shared_ptr<RtspPlayer> Ptr;
|
||||
|
@ -361,10 +361,11 @@ void RtspSession::onAuthSuccess() {
|
||||
strongSelf->shutdown(SockException(Err_shutdown,err));
|
||||
return;
|
||||
}
|
||||
//找到了响应的rtsp流
|
||||
//找到了相应的rtsp流
|
||||
strongSelf->_aTrackInfo = SdpParser(rtsp_src->getSdp()).getAvailableTrack();
|
||||
if (strongSelf->_aTrackInfo.empty()) {
|
||||
//该流无效
|
||||
DebugL << "无trackInfo,该流无效";
|
||||
strongSelf->send_StreamNotFound();
|
||||
strongSelf->shutdown(SockException(Err_shutdown,"can not find any availabe track in sdp"));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user