Skip to content

Commit d7b43c1

Browse files
ossrs-aiwinlinvip
authored andcommitted
AI: Support VP9 codec for WebRTC
1 parent 1a96abc commit d7b43c1

File tree

4 files changed

+14
-34
lines changed

4 files changed

+14
-34
lines changed

trunk/src/utest/srs_utest_manual_mock.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ ISrsRequest *MockRtcAsyncCallRequest::as_http()
306306
MockRtcSource::MockRtcSource()
307307
{
308308
on_rtp_count_ = 0;
309+
rtp_audio_count_ = 0;
310+
rtp_video_count_ = 0;
309311
}
310312

311313
MockRtcSource::~MockRtcSource()
@@ -315,6 +317,14 @@ MockRtcSource::~MockRtcSource()
315317
srs_error_t MockRtcSource::on_rtp(SrsRtpPacket *pkt)
316318
{
317319
on_rtp_count_++;
320+
321+
// Count audio and video packets separately
322+
if (pkt->frame_type_ == SrsFrameTypeAudio) {
323+
rtp_audio_count_++;
324+
} else if (pkt->frame_type_ == SrsFrameTypeVideo) {
325+
rtp_video_count_++;
326+
}
327+
318328
return SrsRtcSource::on_rtp(pkt);
319329
}
320330

trunk/src/utest/srs_utest_manual_mock.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ class MockRtcSource : public SrsRtcSource
162162
{
163163
public:
164164
int on_rtp_count_;
165+
int rtp_audio_count_;
166+
int rtp_video_count_;
165167

166168
public:
167169
MockRtcSource();

trunk/src/utest/srs_utest_workflow_rtc_conn.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,7 @@ ISrsRtcPublishStream *MockAppFactoryForRtcConn::create_rtc_publish_stream(ISrsEx
8181
return publisher;
8282
}
8383

84-
MockRtcSourceForRtcConn::MockRtcSourceForRtcConn()
85-
{
86-
rtp_audio_count_ = 0;
87-
rtp_video_count_ = 0;
88-
}
89-
90-
MockRtcSourceForRtcConn::~MockRtcSourceForRtcConn()
91-
{
92-
}
9384

94-
srs_error_t MockRtcSourceForRtcConn::on_rtp(SrsRtpPacket *pkt)
95-
{
96-
if (pkt->frame_type_ == SrsFrameTypeAudio) {
97-
rtp_audio_count_++;
98-
} else if (pkt->frame_type_ == SrsFrameTypeVideo) {
99-
rtp_video_count_++;
100-
}
101-
return srs_success;
102-
}
10385

10486
// This test is used to verify the basic workflow of the RTC connection.
10587
// It's finished with the help of AI, but each step is manually designed
@@ -121,7 +103,7 @@ VOID TEST(BasicWorkflowRtcConnTest, ManuallyVerifyForPlayer)
121103
mock_dtls_certificate->fingerprint_ = "test-fingerprint";
122104
mock_app_factory->rtc_sources_ = mock_rtc_sources.get();
123105
mock_app_factory->mock_protocol_utility_ = new MockProtocolUtilityForRtcConn("192.168.1.100");
124-
MockRtcSourceForRtcConn *mock_rtc_source = new MockRtcSourceForRtcConn();
106+
MockRtcSource *mock_rtc_source = new MockRtcSource();
125107
mock_rtc_sources->mock_source_ = SrsSharedPtr<SrsRtcSource>(mock_rtc_source);
126108

127109
// Create a real ISrsRtcConnection using _srs_app_factory_
@@ -272,7 +254,7 @@ VOID TEST(BasicWorkflowRtcConnTest, ManuallyVerifyForPublisher)
272254
mock_dtls_certificate->fingerprint_ = "test-fingerprint";
273255
mock_app_factory->rtc_sources_ = mock_rtc_sources.get();
274256
mock_app_factory->mock_protocol_utility_ = new MockProtocolUtilityForRtcConn("192.168.1.100");
275-
MockRtcSourceForRtcConn *mock_rtc_source = new MockRtcSourceForRtcConn();
257+
MockRtcSource *mock_rtc_source = new MockRtcSource();
276258
mock_rtc_sources->mock_source_ = SrsSharedPtr<SrsRtcSource>(mock_rtc_source);
277259

278260
// Create a real ISrsRtcConnection using _srs_app_factory_

trunk/src/utest/srs_utest_workflow_rtc_conn.hpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,4 @@ class MockAppFactoryForRtcConn : public SrsAppFactory
6666
virtual ISrsRtcPublishStream *create_rtc_publish_stream(ISrsExecRtcAsyncTask *exec, ISrsExpire *expire, ISrsRtcPacketReceiver *receiver, const SrsContextId &cid);
6767
};
6868

69-
class MockRtcSourceForRtcConn : public SrsRtcSource
70-
{
71-
public:
72-
int rtp_audio_count_;
73-
int rtp_video_count_;
74-
75-
public:
76-
MockRtcSourceForRtcConn();
77-
virtual ~MockRtcSourceForRtcConn();
78-
79-
public:
80-
virtual srs_error_t on_rtp(SrsRtpPacket *pkt);
81-
};
82-
8369
#endif

0 commit comments

Comments
 (0)