1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Optimize init h265 track and format.

This commit is contained in:
chundonglinlin 2025-02-21 23:05:39 +08:00
parent 83e8877623
commit 8953dbfba1
7 changed files with 49 additions and 53 deletions

View file

@ -13,7 +13,6 @@
#include <srs_protocol_rtmp_stack.hpp>
#include <srs_kernel_rtc_rtp.hpp>
#include <srs_core_autofree.hpp>
#include <srs_protocol_utility.hpp>
#include <vector>
using namespace std;
@ -145,7 +144,7 @@ void SrsFrameToRtcBridge::on_unpublish()
srs_error_t SrsFrameToRtcBridge::on_frame(SrsSharedPtrMessage* frame)
{
#ifdef SRS_FFMPEG_FIT
#ifdef SRS_FFMPEG_FIT
return rtp_builder_->on_frame(frame);
#else
return srs_success;
@ -157,25 +156,6 @@ srs_error_t SrsFrameToRtcBridge::on_rtp(SrsRtpPacket* pkt)
return source_->on_rtp(pkt);
}
srs_error_t SrsFrameToRtcBridge::update_codec(SrsVideoCodecId id)
{
// init with H264 default, so we need check if it's H265 only.
if (id == SrsVideoCodecIdHEVC) {
if (source_->get_track_desc("video", "H265").empty()) {
std::vector<SrsRtcTrackDescription*> video_track_descs = source_->get_track_desc("video", "H264");
if (!video_track_descs.empty()) {
SrsRtcTrackDescription* video_track_desc = video_track_descs.at(0);
SrsVideoPayload* video_payload = (SrsVideoPayload*)video_track_desc->media_;
video_payload->name_ = "H265";
video_payload->set_h265_param_desc("level-id=180;profile-id=1;tier-flag=0;tx-mode=SRST");
srs_trace("RTC: Switch video codec %d(%s) to %d(%s)", SrsVideoCodecIdAVC, srs_video_codec_id2str(SrsVideoCodecIdAVC).c_str(),
id, srs_video_codec_id2str(id).c_str());
}
}
}
return srs_success;
}
#endif
SrsCompositeBridge::SrsCompositeBridge()