Format code by clang-format

This commit is contained in:
winlin 2025-10-31 19:10:37 -04:00
parent 4208d353db
commit bd1b9a364b
17 changed files with 35 additions and 45 deletions

View File

@ -1132,7 +1132,7 @@ srs_error_t SrsHlsFmp4Muxer::do_refresh_m3u8_segment(SrsHlsM4sSegment *segment,
}
// ss << segment->uri << SRS_CONSTS_LF;
ss << path.filepath_base(seg_uri) << SRS_CONSTS_LF;
return err;
}
@ -2947,4 +2947,3 @@ void SrsHls::hls_show_mux_log()
srsu2msi(controller_->duration()), controller_->deviation());
}
// LCOV_EXCL_STOP

View File

@ -9,9 +9,9 @@
#include <srs_core.hpp>
#include <sstream>
#include <string>
#include <vector>
#include <sstream>
#include <srs_app_async_call.hpp>
#include <srs_app_fragment.hpp>

View File

@ -731,4 +731,3 @@ srs_error_t SrsHttpStaticServer::mount_vhost(string vhost, string &pmount)
return err;
}
// LCOV_EXCL_STOP

View File

@ -817,7 +817,7 @@ srs_error_t SrsUdpMuxListener::cycle()
pprint->elapse();
if (pprint->can_print()) {
// LCOV_EXCL_START
// For performance, only restore context when output log.
_srs_context->set_id(cid_);

View File

@ -172,4 +172,3 @@ void SrsFileLog::open_log_file()
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
}
// LCOV_EXCL_STOP

View File

@ -371,4 +371,3 @@ void SrsProcess::fast_kill()
return;
}
// LCOV_EXCL_STOP

View File

@ -24,4 +24,3 @@ srs_error_t ISrsReloadHandler::on_reload_vhost_chunk_size(string /*vhost*/)
return srs_success;
}
// LCOV_EXCL_STOP

View File

@ -1532,10 +1532,10 @@ srs_error_t SrsRtcPublishStream::on_twcc(uint16_t sn)
{
srs_error_t err = srs_success;
// To get more accurate timestamp, and avoid deviation caused by coroutine scheduler,
// To get more accurate timestamp, and avoid deviation caused by coroutine scheduler,
// we use realtime for TWCC.
srs_utime_t now = srs_time_now_realtime();
err = rtcp_twcc_->recv_packet(sn, now);
return err;

View File

@ -1129,4 +1129,3 @@ srs_error_t SrsSRTP::unprotect_rtcp(void *packet, int *nb_plaintext)
return err;
}
// LCOV_EXCL_STOP

View File

@ -596,4 +596,3 @@ srs_error_t SrsRtcSessionManager::on_udp_packet(ISrsUdpMuxSocket *skt)
return srs_error_new(ERROR_RTC_UDP, "unknown packet");
}
// LCOV_EXCL_STOP

View File

@ -634,7 +634,8 @@ srs_error_t SrsRtmpConn::stream_service_cycle()
}
default: {
return srs_error_new(ERROR_SYSTEM_CLIENT_INVALID, "rtmp: unknown client type=%d", info_->type_);
}}
}
}
// LCOV_EXCL_STOP
return err;
@ -759,7 +760,7 @@ srs_error_t SrsRtmpConn::redirect_to_origin_cluster(SrsSharedPtr<SrsLiveSource>
string rurl = srs_net_url_encode_rtmp_url(host, port, req->host_, req->vhost_, req->app_, req->stream_, req->param_);
srs_trace("rtmp: redirect in cluster, from=%s:%d, target=%s:%d, url=%s, rurl=%s",
req->host_.c_str(), req->port_, host.c_str(), port, url.c_str(), rurl.c_str());
req->host_.c_str(), req->port_, host.c_str(), port, url.c_str(), rurl.c_str());
// Ignore if host or port is invalid.
if (host.empty() || port == 0) {
@ -1676,4 +1677,3 @@ void SrsRtmpConn::expire()
trd_->interrupt();
}
// LCOV_EXCL_STOP

View File

@ -2638,4 +2638,3 @@ void SrsLiveSource::on_edge_proxy_unpublish()
publish_edge_->on_proxy_unpublish();
}
// LCOV_EXCL_STOP

View File

@ -2042,4 +2042,3 @@ void SrsPidFileLocker::close()
}
}
// LCOV_EXCL_STOP

View File

@ -484,4 +484,3 @@ srs_error_t run_srs_server()
return err;
}
// LCOV_EXCL_STOP

View File

@ -613,7 +613,7 @@ void retrieve_local_ips(SrsProtocolUtility *utility)
bool loopback = (cur->ifa_flags & IFF_LOOPBACK);
if (ipv4 && ready && !ignored) {
discover_network_iface(utility, cur, ips, ss0, ss1, false, loopback);
}
}
// LCOV_EXCL_STOP
}
}

View File

@ -1103,7 +1103,7 @@ VOID TEST(AppHlsTest, HlsControllerWriteAudioTypicalScenario)
MockHlsRequest mock_request("__defaultVhost__", "live", "test");
// Cast to concrete type to access private members for testing
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer*>(controller->muxer_);
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer *>(controller->muxer_);
srs_assert(muxer);
// Set up muxer with required fields
@ -1419,7 +1419,7 @@ VOID TEST(AppHlsTest, HlsControllerSelectionTypicalScenario)
HELPER_EXPECT_SUCCESS(controller->initialize());
// Cast to concrete type to access private members for testing
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer*>(controller->muxer_);
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer *>(controller->muxer_);
srs_assert(muxer);
// Test initial state - no current segment
@ -1490,7 +1490,7 @@ VOID TEST(AppHlsTest, HlsControllerOnPublishTypicalScenario)
HELPER_EXPECT_SUCCESS(controller->initialize());
// Cast to concrete type to access private members for testing
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer*>(controller->muxer_);
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer *>(controller->muxer_);
srs_assert(muxer);
// Create mock request
@ -1560,7 +1560,7 @@ VOID TEST(AppHlsTest, HlsControllerOnUnpublishTypicalScenario)
HELPER_EXPECT_SUCCESS(controller->initialize());
// Cast to concrete type to access private members for testing
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer*>(controller->muxer_);
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer *>(controller->muxer_);
srs_assert(muxer);
// Create mock request
@ -1616,7 +1616,7 @@ VOID TEST(AppHlsTest, HlsControllerWriteVideoTypicalScenario)
HELPER_EXPECT_SUCCESS(controller->initialize());
// Cast to concrete type to access private members for testing
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer*>(controller->muxer_);
SrsHlsMuxer *muxer = dynamic_cast<SrsHlsMuxer *>(controller->muxer_);
srs_assert(muxer);
// Create mock request

View File

@ -5,22 +5,22 @@
//
#include <srs_utest_ai24.hpp>
#include <srs_app_rtc_source.hpp>
#include <srs_kernel_error.hpp>
#include <srs_kernel_rtc_rtcp.hpp>
#include <srs_protocol_sdp.hpp>
#include <srs_kernel_packet.hpp>
#include <srs_kernel_codec.hpp>
#include <srs_app_hls.hpp>
#include <srs_utest_manual_mock.hpp>
#include <srs_utest_manual_kernel.hpp>
#include <srs_app_config.hpp>
#include <srs_app_http_hooks.hpp>
#include <srs_app_utility.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_protocol_utility.hpp>
#include <srs_app_fragment.hpp>
#include <srs_app_hls.hpp>
#include <srs_app_http_hooks.hpp>
#include <srs_app_rtc_source.hpp>
#include <srs_app_server.hpp>
#include <srs_app_utility.hpp>
#include <srs_kernel_codec.hpp>
#include <srs_kernel_error.hpp>
#include <srs_kernel_packet.hpp>
#include <srs_kernel_rtc_rtcp.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_protocol_sdp.hpp>
#include <srs_protocol_utility.hpp>
#include <srs_utest_manual_kernel.hpp>
#include <srs_utest_manual_mock.hpp>
#ifdef SRS_FFMPEG_FIT
#include <srs_app_rtc_codec.hpp>
@ -389,7 +389,7 @@ VOID TEST(ParsedPacketTest, CopyParsedVideoPacket)
// Add sample data
uint8_t sample_data[] = {0x65, 0x88, 0x84, 0x00};
HELPER_EXPECT_SUCCESS(packet.add_sample((char*)sample_data, sizeof(sample_data)));
HELPER_EXPECT_SUCCESS(packet.add_sample((char *)sample_data, sizeof(sample_data)));
// Copy the packet
SrsParsedVideoPacket *copied = packet.copy();
@ -517,7 +517,7 @@ VOID TEST(DvrAsyncCallOnHlsTest, CallWithMultipleHooks)
// Mock HLS muxer for testing SrsHlsController::reap_segment
class MockHlsMuxerForReapSegment : public ISrsHlsMuxer
{
SRS_DECLARE_PRIVATE:
SRS_DECLARE_PRIVATE:
int segment_close_count_;
int segment_open_count_;
int flush_video_count_;
@ -659,7 +659,7 @@ VOID TEST(HlsControllerTest, ReapSegmentSuccess)
// Mock HLS segment for testing do_segment_close
class MockHlsSegmentForSegmentClose : public SrsHlsSegment
{
SRS_DECLARE_PRIVATE:
SRS_DECLARE_PRIVATE:
srs_error_t rename_error_;
srs_utime_t mock_duration_;
bool rename_called_;
@ -851,8 +851,8 @@ VOID TEST(HlsFmp4MuxerTest, DoRefreshM3u8SegmentWithEncryption)
// Create mock segment
MockHlsM4sSegment segment;
segment.sequence_no_ = 10; // 10 % 5 == 0, so key should be written
segment.is_sequence_header_ = true; // Should write discontinuity
segment.sequence_no_ = 10; // 10 % 5 == 0, so key should be written
segment.is_sequence_header_ = true; // Should write discontinuity
segment.duration_ = 5000 * SRS_UTIME_MILLISECONDS; // 5 seconds
segment.fullpath_ = "/path/to/segment-[duration].m4s";
@ -885,7 +885,7 @@ VOID TEST(HlsFmp4MuxerTest, DoRefreshM3u8SegmentWithEncryption)
// Mock HLS segment for testing SrsHlsMuxer::do_refresh_m3u8_segment
class MockHlsSegmentForRefreshM3u8 : public SrsHlsSegment
{
SRS_DECLARE_PRIVATE:
SRS_DECLARE_PRIVATE:
bool is_sequence_header_;
srs_utime_t duration_;
@ -931,8 +931,8 @@ VOID TEST(HlsMuxerTest, DoRefreshM3u8SegmentWithEncryption)
// Create mock segment
MockHlsSegmentForRefreshM3u8 segment;
segment.sequence_no_ = 10; // 10 % 5 == 0, so key should be written
segment.set_is_sequence_header(true); // Should write discontinuity
segment.sequence_no_ = 10; // 10 % 5 == 0, so key should be written
segment.set_is_sequence_header(true); // Should write discontinuity
segment.set_duration(5000 * SRS_UTIME_MILLISECONDS); // 5 seconds
// Call do_refresh_m3u8_segment