优化函数命名

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

@@ -246,7 +246,7 @@ AACTrack::AACTrack(const string &aac_cfg) {
onReady();
}
const string &AACTrack::getAacCfg() const {
const string &AACTrack::getConfig() const {
return _cfg;
}
@@ -342,7 +342,7 @@ Sdp::Ptr AACTrack::getSdp() {
WarnL << getCodecName() << " Track未准备好";
return nullptr;
}
return std::make_shared<AACSdp>(getAacCfg(), getAudioSampleRate(), getAudioChannel(), getBitRate() / 1024);
return std::make_shared<AACSdp>(getConfig(), getAudioSampleRate(), getAudioChannel(), getBitRate() / 1024);
}
}//namespace mediakit

View File

@@ -44,7 +44,7 @@ public:
/**
* 获取aac 配置信息
*/
const std::string &getAacCfg() const;
const std::string &getConfig() const;
bool ready() override;
CodecId getCodecId() const override;

View File

@@ -16,7 +16,7 @@ using namespace toolkit;
namespace mediakit {
static string getAacCfg(const RtmpPacket &thiz) {
static string getConfig(const RtmpPacket &thiz) {
string ret;
if ((RtmpAudioCodec)thiz.getRtmpCodecId() != RtmpAudioCodec::aac) {
return ret;
@@ -30,8 +30,8 @@ static string getAacCfg(const RtmpPacket &thiz) {
}
void AACRtmpDecoder::inputRtmp(const RtmpPacket::Ptr &pkt) {
if (pkt->isCfgFrame()) {
_aac_cfg = getAacCfg(*pkt);
if (pkt->isConfigFrame()) {
_aac_cfg = getConfig(*pkt);
if (!_aac_cfg.empty()) {
onGetAAC(nullptr, 0, 0);
}
@@ -79,7 +79,7 @@ AACRtmpEncoder::AACRtmpEncoder(const Track::Ptr &track) {
void AACRtmpEncoder::makeConfigPacket() {
if (_track && _track->ready()) {
//从track中和获取aac配置信息
_aac_cfg = _track->getAacCfg();
_aac_cfg = _track->getConfig();
}
if (!_aac_cfg.empty()) {

View File

@@ -64,7 +64,7 @@ AACRtpDecoder::AACRtpDecoder(const Track::Ptr &track) {
if (!aacTrack || !aacTrack->ready()) {
WarnL << "该aac track无效!";
} else {
_aac_cfg = aacTrack->getAacCfg();
_aac_cfg = aacTrack->getConfig();
}
obtainFrame();
}

View File

@@ -56,7 +56,7 @@ static bool getH264Config(const RtmpPacket &thiz, string &sps, string &pps) {
}
void H264RtmpDecoder::inputRtmp(const RtmpPacket::Ptr &pkt) {
if (pkt->isCfgFrame()) {
if (pkt->isConfigFrame()) {
//缓存sps pps后续插入到I帧之前
if (!getH264Config(*pkt, _sps, _pps)) {
WarnL << "get h264 sps/pps failed, rtmp packet is: " << hexdump(pkt->data(), pkt->size());

View File

@@ -124,7 +124,7 @@ void H265RtmpDecoder::inputRtmp(const RtmpPacket::Ptr &pkt) {
}
// 国内扩展(12) H265 rtmp
if (pkt->isCfgFrame()) {
if (pkt->isConfigFrame()) {
#ifdef ENABLE_MP4
string config;
if (getH265ConfigFrame(*pkt, config)) {