Commit ba947cb6 by ziyue

调整switch case语句缩进

parent f85de2e1
...@@ -179,32 +179,32 @@ bool H264Track::inputFrame_l(const Frame::Ptr &frame) { ...@@ -179,32 +179,32 @@ bool H264Track::inputFrame_l(const Frame::Ptr &frame) {
int type = H264_TYPE(frame->data()[frame->prefixSize()]); int type = H264_TYPE(frame->data()[frame->prefixSize()]);
bool ret = true; bool ret = true;
switch (type) { switch (type) {
case H264Frame::NAL_SPS: { case H264Frame::NAL_SPS: {
_sps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize()); _sps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
_latest_is_config_frame = true; _latest_is_config_frame = true;
ret = VideoTrack::inputFrame(frame); ret = VideoTrack::inputFrame(frame);
break; break;
}
case H264Frame::NAL_PPS: {
_pps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
_latest_is_config_frame = true;
ret = VideoTrack::inputFrame(frame);
break;
}
default:
// 避免识别不出关键帧
if (_latest_is_config_frame && !frame->dropAble()) {
if (!frame->keyFrame()) {
const_cast<Frame::Ptr &>(frame) = std::make_shared<FrameCacheAble>(frame, true);
}
} }
// 判断是否是I帧, 并且如果是,那判断前面是否插入过config帧, 如果插入过就不插入了 case H264Frame::NAL_PPS: {
if (frame->keyFrame() && !_latest_is_config_frame) { _pps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
insertConfigFrame(frame); _latest_is_config_frame = true;
ret = VideoTrack::inputFrame(frame);
break;
} }
_latest_is_config_frame = false; default:
ret = VideoTrack::inputFrame(frame); // 避免识别不出关键帧
break; if (_latest_is_config_frame && !frame->dropAble()) {
if (!frame->keyFrame()) {
const_cast<Frame::Ptr &>(frame) = std::make_shared<FrameCacheAble>(frame, true);
}
}
// 判断是否是I帧, 并且如果是,那判断前面是否插入过config帧, 如果插入过就不插入了
if (frame->keyFrame() && !_latest_is_config_frame) {
insertConfigFrame(frame);
}
_latest_is_config_frame = false;
ret = VideoTrack::inputFrame(frame);
break;
} }
if (_width == 0 && ready()) { if (_width == 0 && ready()) {
......
...@@ -321,16 +321,10 @@ bool HandshakePacket::loadExtMessage(uint8_t *buf, size_t len) { ...@@ -321,16 +321,10 @@ bool HandshakePacket::loadExtMessage(uint8_t *buf, size_t len) {
type = loadUint16(ptr); type = loadUint16(ptr);
length = loadUint16(ptr + 2); length = loadUint16(ptr + 2);
switch (type) { switch (type) {
case HSExt::SRT_CMD_HSREQ: case HSExt::SRT_CMD_HSREQ:
case HSExt::SRT_CMD_HSRSP: case HSExt::SRT_CMD_HSRSP: ext = std::make_shared<HSExtMessage>(); break;
ext = std::make_shared<HSExtMessage>(); case HSExt::SRT_CMD_SID: ext = std::make_shared<HSExtStreamID>(); break;
break; default: WarnL << "not support ext " << type; break;
case HSExt::SRT_CMD_SID:
ext = std::make_shared<HSExtStreamID>();
break;
default:
WarnL << "not support ext " << type;
break;
} }
if (ext) { if (ext) {
if (ext->loadFromData(ptr, length * 4 + 4)) { if (ext->loadFromData(ptr, length * 4 + 4)) {
......
...@@ -123,21 +123,10 @@ DepLibSRTP::DepLibSRTP() { ...@@ -123,21 +123,10 @@ DepLibSRTP::DepLibSRTP() {
err = srtp_install_event_handler([](srtp_event_data_t *data) { err = srtp_install_event_handler([](srtp_event_data_t *data) {
MS_TRACE(); MS_TRACE();
switch (data->event) { switch (data->event) {
case event_ssrc_collision: case event_ssrc_collision: MS_WARN_TAG(srtp, "SSRC collision occurred"); break;
MS_WARN_TAG(srtp, "SSRC collision occurred"); case event_key_soft_limit: MS_WARN_TAG(srtp, "stream reached the soft key usage limit and will expire soon"); break;
break; case event_key_hard_limit: MS_WARN_TAG(srtp, "stream reached the hard key usage limit and has expired"); break;
case event_packet_index_limit: MS_WARN_TAG(srtp, "stream reached the hard packet limit (2^48 packets)"); break;
case event_key_soft_limit:
MS_WARN_TAG(srtp, "stream reached the soft key usage limit and will expire soon");
break;
case event_key_hard_limit:
MS_WARN_TAG(srtp, "stream reached the hard key usage limit and has expired");
break;
case event_packet_index_limit:
MS_WARN_TAG(srtp, "stream reached the hard packet limit (2^48 packets)");
break;
} }
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论