优化函数命名

isCfgFrame -> isConfigFrame
getAacCfg -> getConfig
This commit is contained in:
xia-chu
2023-07-22 19:40:28 +08:00
parent 780a1eb9fc
commit 3e9a8b9d8b
13 changed files with 24 additions and 19 deletions

View File

@@ -62,7 +62,7 @@ bool FlvPlayer::onRecvMetadata(const AMFValue &metadata) {
}
void FlvPlayer::onRecvRtmpPacket(RtmpPacket::Ptr packet) {
if (!_play_result && !packet->isCfgFrame()) {
if (!_play_result && !packet->isConfigFrame()) {
_play_result = true;
onPlayResult(SockException(Err_success, "play http-flv success"));
}

View File

@@ -167,7 +167,7 @@ bool RtmpPacket::isVideoKeyFrame() const {
return frame_type == RtmpFrameType::key_frame;
}
bool RtmpPacket::isCfgFrame() const {
bool RtmpPacket::isConfigFrame() const {
switch (type_id) {
case MSG_AUDIO: {
return (RtmpAudioCodec)getRtmpCodecId() == RtmpAudioCodec::aac && (RtmpAACPacketType)buffer[1] == RtmpAACPacketType::aac_config_header;

View File

@@ -169,10 +169,15 @@ public:
}
void clear();
// video config frame和key frame都返回true
// 用于gop缓存定位
bool isVideoKeyFrame() const;
// aac config或h264/h265 config
bool isCfgFrame() const;
// aac config或h264/h265 config返回true支持增强型rtmp
// 用于缓存解码配置信息
bool isConfigFrame() const;
int getRtmpCodecId() const;
int getAudioSampleRate() const;
int getAudioSampleBit() const;

View File

@@ -54,7 +54,7 @@ void RtmpMediaSource::onWrite(RtmpPacket::Ptr pkt, bool /*= true*/) {
default: break;
}
if (pkt->isCfgFrame()) {
if (pkt->isConfigFrame()) {
std::lock_guard<std::recursive_mutex> lock(_mtx);
_config_frame_map[pkt->type_id] = pkt;
if (!_ring) {

View File

@@ -339,7 +339,7 @@ void RtmpPlayer::onMediaData_l(RtmpPacket::Ptr chunk_data) {
return;
}
if (chunk_data->isCfgFrame()) {
if (chunk_data->isConfigFrame()) {
//输入配置帧以便初始化完成各个track
onRtmpPacket(chunk_data);
} else {