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

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2981513002: Wire up RTP keep-alive in ortc api. (Closed)
Patch Set: deps, again Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <algorithm> // max 10 #include <algorithm> // max
11 #include <memory> 11 #include <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "webrtc/call/call.h" 14 #include "webrtc/call/call.h"
15 #include "webrtc/call/rtp_transport_controller_send.h"
15 #include "webrtc/common_video/include/frame_callback.h" 16 #include "webrtc/common_video/include/frame_callback.h"
16 #include "webrtc/common_video/include/video_frame.h" 17 #include "webrtc/common_video/include/video_frame.h"
17 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h" 21 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h"
21 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 22 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
22 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 23 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
23 #include "webrtc/rtc_base/bind.h" 24 #include "webrtc/rtc_base/bind.h"
24 #include "webrtc/rtc_base/checks.h" 25 #include "webrtc/rtc_base/checks.h"
(...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 RunBaseTest(&test); 3373 RunBaseTest(&test);
3373 } 3374 }
3374 3375
3375 TEST_F(VideoSendStreamTest, SendsKeepAlive) { 3376 TEST_F(VideoSendStreamTest, SendsKeepAlive) {
3376 const int kTimeoutMs = 50; // Really short timeout for testing. 3377 const int kTimeoutMs = 50; // Really short timeout for testing.
3377 3378
3378 class KeepaliveObserver : public test::SendTest { 3379 class KeepaliveObserver : public test::SendTest {
3379 public: 3380 public:
3380 KeepaliveObserver() : SendTest(kDefaultTimeoutMs) {} 3381 KeepaliveObserver() : SendTest(kDefaultTimeoutMs) {}
3381 3382
3382 Call::Config GetSenderCallConfig() override { 3383 void OnRtpTransportControllerSendCreated(
3383 Call::Config config = SendTest::GetSenderCallConfig(); 3384 RtpTransportControllerSend* controller) override {
3384 config.keepalive_config.timeout_interval_ms = kTimeoutMs; 3385 RtpKeepAliveConfig config;
3385 config.keepalive_config.payload_type = 3386 config.timeout_interval_ms = kTimeoutMs;
3386 CallTest::kDefaultKeepalivePayloadType; 3387 config.payload_type = CallTest::kDefaultKeepalivePayloadType;
3387 return config; 3388 controller->SetKeepAliveConfig(config);
3388 } 3389 }
3389 3390
3390 private: 3391 private:
3391 Action OnSendRtp(const uint8_t* packet, size_t length) override { 3392 Action OnSendRtp(const uint8_t* packet, size_t length) override {
3392 RTPHeader header; 3393 RTPHeader header;
3393 EXPECT_TRUE(parser_->Parse(packet, length, &header)); 3394 EXPECT_TRUE(parser_->Parse(packet, length, &header));
3394 3395
3395 if (header.payloadType != CallTest::kDefaultKeepalivePayloadType) { 3396 if (header.payloadType != CallTest::kDefaultKeepalivePayloadType) {
3396 // The video stream has started. Stop it now. 3397 // The video stream has started. Stop it now.
3397 if (capturer_) 3398 if (capturer_)
(...skipping 14 matching lines...) Expand all
3412 capturer_ = frame_generator_capturer; 3413 capturer_ = frame_generator_capturer;
3413 } 3414 }
3414 3415
3415 test::FrameGeneratorCapturer* capturer_ = nullptr; 3416 test::FrameGeneratorCapturer* capturer_ = nullptr;
3416 } test; 3417 } test;
3417 3418
3418 RunBaseTest(&test); 3419 RunBaseTest(&test);
3419 } 3420 }
3420 3421
3421 } // namespace webrtc 3422 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698