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

Side by Side Diff: media/cast/sender/video_sender_unittest.cc

Issue 387933005: Cast: Refactor RTCP handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: smaller diff Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/test/simple_test_tick_clock.h" 11 #include "base/test/simple_test_tick_clock.h"
12 #include "media/base/video_frame.h" 12 #include "media/base/video_frame.h"
13 #include "media/cast/cast_environment.h" 13 #include "media/cast/cast_environment.h"
14 #include "media/cast/logging/simple_event_subscriber.h" 14 #include "media/cast/logging/simple_event_subscriber.h"
15 #include "media/cast/net/cast_transport_config.h" 15 #include "media/cast/net/cast_transport_config.h"
16 #include "media/cast/net/cast_transport_sender_impl.h" 16 #include "media/cast/net/cast_transport_sender_impl.h"
17 #include "media/cast/net/pacing/paced_sender.h" 17 #include "media/cast/net/pacing/paced_sender.h"
18 #include "media/cast/net/rtcp/rtcp_receiver.h"
18 #include "media/cast/sender/video_sender.h" 19 #include "media/cast/sender/video_sender.h"
19 #include "media/cast/test/fake_single_thread_task_runner.h" 20 #include "media/cast/test/fake_single_thread_task_runner.h"
20 #include "media/cast/test/fake_video_encode_accelerator.h" 21 #include "media/cast/test/fake_video_encode_accelerator.h"
21 #include "media/cast/test/utility/default_config.h" 22 #include "media/cast/test/utility/default_config.h"
22 #include "media/cast/test/utility/video_utility.h" 23 #include "media/cast/test/utility/video_utility.h"
23 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 namespace media { 27 namespace media {
27 namespace cast { 28 namespace cast {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 paused_(false) {} 60 paused_(false) {}
60 61
61 // A singular packet implies a RTCP packet. 62 // A singular packet implies a RTCP packet.
62 virtual bool SendPacket(PacketRef packet, 63 virtual bool SendPacket(PacketRef packet,
63 const base::Closure& cb) OVERRIDE { 64 const base::Closure& cb) OVERRIDE {
64 if (paused_) { 65 if (paused_) {
65 stored_packet_ = packet; 66 stored_packet_ = packet;
66 callback_ = cb; 67 callback_ = cb;
67 return false; 68 return false;
68 } 69 }
69 if (Rtcp::IsRtcpPacket(&packet->data[0], packet->data.size())) { 70 if (RtcpReceiver::IsRtcpPacket(&packet->data[0], packet->data.size())) {
70 ++number_of_rtcp_packets_; 71 ++number_of_rtcp_packets_;
71 } else { 72 } else {
72 // Check that at least one RTCP packet was sent before the first RTP 73 // Check that at least one RTCP packet was sent before the first RTP
73 // packet. This confirms that the receiver will have the necessary lip 74 // packet. This confirms that the receiver will have the necessary lip
74 // sync info before it has to calculate the playout time of the first 75 // sync info before it has to calculate the playout time of the first
75 // frame. 76 // frame.
76 if (number_of_rtp_packets_ == 0) 77 if (number_of_rtp_packets_ == 0)
77 EXPECT_LE(1, number_of_rtcp_packets_); 78 EXPECT_LE(1, number_of_rtcp_packets_);
78 ++number_of_rtp_packets_; 79 ++number_of_rtp_packets_;
79 } 80 }
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 video_sender_->OnReceivedCastFeedback(cast_feedback); 517 video_sender_->OnReceivedCastFeedback(cast_feedback);
517 518
518 transport_.SetPause(false); 519 transport_.SetPause(false);
519 RunTasks(33); 520 RunTasks(33);
520 // Only one packet should be retransmitted. 521 // Only one packet should be retransmitted.
521 EXPECT_EQ(1, transport_.number_of_rtp_packets()); 522 EXPECT_EQ(1, transport_.number_of_rtp_packets());
522 } 523 }
523 524
524 } // namespace cast 525 } // namespace cast
525 } // namespace media 526 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698