Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: webrtc/video/video_send_stream_tests.cc

Issue 2960363002: Implement RTP keepalive in native stack. (Closed)
Patch Set: Cleanup Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | webrtc/video_send_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_send_stream_tests.cc
diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc
index 37a0249e377e1066a5cc8f3266be39b2ec329457..7fa12e1c50fa0bb07e3a54f7e53714add9a8d5bf 100644
--- a/webrtc/video/video_send_stream_tests.cc
+++ b/webrtc/video/video_send_stream_tests.cc
@@ -32,13 +32,14 @@
#include "webrtc/test/call_test.h"
#include "webrtc/test/configurable_frame_size_encoder.h"
#include "webrtc/test/fake_texture_frame.h"
+#include "webrtc/test/field_trial.h"
#include "webrtc/test/frame_generator.h"
+#include "webrtc/test/frame_generator_capturer.h"
#include "webrtc/test/frame_utils.h"
#include "webrtc/test/gtest.h"
#include "webrtc/test/null_transport.h"
#include "webrtc/test/rtcp_packet_parser.h"
#include "webrtc/test/testsupport/perf_test.h"
-#include "webrtc/test/field_trial.h"
#include "webrtc/video/send_statistics_proxy.h"
#include "webrtc/video/transport_adapter.h"
@@ -3407,4 +3408,51 @@ TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) {
RunBaseTest(&test);
}
+TEST_F(VideoSendStreamTest, SendsKeepAlive) {
+ const int kTimeoutMs = 50; // Really short timeout for testing.
+ const int kPayloadType = 20;
+
+ class KeepaliveObserver : public test::SendTest {
+ public:
+ KeepaliveObserver() : SendTest(kDefaultTimeoutMs) {}
+
+ private:
+ Action OnSendRtp(const uint8_t* packet, size_t length) override {
+ RTPHeader header;
+ EXPECT_TRUE(parser_->Parse(packet, length, &header));
+
+ if (header.payloadType != kPayloadType) {
+ // The video stream has started. Stop it now.
+ if (capturer_)
+ capturer_->Stop();
+ } else {
+ observation_complete_.Set();
+ }
+
+ return SEND_PACKET;
+ }
+
+ void ModifyVideoConfigs(
+ VideoSendStream::Config* send_config,
+ std::vector<VideoReceiveStream::Config>* receive_configs,
+ VideoEncoderConfig* encoder_config) override {
+ send_config->rtp.keep_alive.timeout_interval_ms = kTimeoutMs;
+ send_config->rtp.keep_alive.payload_type = kPayloadType;
+ }
+
+ void PerformTest() override {
+ EXPECT_TRUE(Wait()) << "Timed out while waiting for keep-alive packet.";
+ }
+
+ void OnFrameGeneratorCapturerCreated(
+ test::FrameGeneratorCapturer* frame_generator_capturer) override {
+ capturer_ = frame_generator_capturer;
+ }
+
+ test::FrameGeneratorCapturer* capturer_ = nullptr;
+ } test;
+
+ RunBaseTest(&test);
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | webrtc/video_send_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698