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

Side by Side Diff: media/cast/sender/audio_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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
11 #include "media/base/media.h" 11 #include "media/base/media.h"
12 #include "media/cast/cast_config.h" 12 #include "media/cast/cast_config.h"
13 #include "media/cast/cast_environment.h" 13 #include "media/cast/cast_environment.h"
14 #include "media/cast/net/cast_transport_config.h" 14 #include "media/cast/net/cast_transport_config.h"
15 #include "media/cast/net/cast_transport_sender_impl.h" 15 #include "media/cast/net/cast_transport_sender_impl.h"
16 #include "media/cast/net/rtcp/rtcp.h" 16 #include "media/cast/net/rtcp/rtcp.h"
miu 2014/07/16 19:58:03 This, and possibly other #includes can now be remo
Alpha Left Google 2014/07/17 01:01:46 Done.
17 #include "media/cast/net/rtcp/rtcp_receiver.h"
17 #include "media/cast/sender/audio_sender.h" 18 #include "media/cast/sender/audio_sender.h"
18 #include "media/cast/test/fake_single_thread_task_runner.h" 19 #include "media/cast/test/fake_single_thread_task_runner.h"
19 #include "media/cast/test/utility/audio_utility.h" 20 #include "media/cast/test/utility/audio_utility.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 namespace media { 23 namespace media {
23 namespace cast { 24 namespace cast {
24 25
25 class TestPacketSender : public PacketSender { 26 class TestPacketSender : public PacketSender {
26 public: 27 public:
27 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {} 28 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {}
28 29
29 virtual bool SendPacket(PacketRef packet, 30 virtual bool SendPacket(PacketRef packet,
30 const base::Closure& cb) OVERRIDE { 31 const base::Closure& cb) OVERRIDE {
31 if (Rtcp::IsRtcpPacket(&packet->data[0], packet->data.size())) { 32 if (RtcpReceiver::IsRtcpPacket(&packet->data[0], packet->data.size())) {
32 ++number_of_rtcp_packets_; 33 ++number_of_rtcp_packets_;
33 } else { 34 } else {
34 // Check that at least one RTCP packet was sent before the first RTP 35 // Check that at least one RTCP packet was sent before the first RTP
35 // packet. This confirms that the receiver will have the necessary lip 36 // packet. This confirms that the receiver will have the necessary lip
36 // sync info before it has to calculate the playout time of the first 37 // sync info before it has to calculate the playout time of the first
37 // frame. 38 // frame.
38 if (number_of_rtp_packets_ == 0) 39 if (number_of_rtp_packets_ == 0)
39 EXPECT_LE(1, number_of_rtcp_packets_); 40 EXPECT_LE(1, number_of_rtcp_packets_);
40 ++number_of_rtp_packets_; 41 ++number_of_rtp_packets_;
41 } 42 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 base::TimeDelta max_rtcp_timeout = 133 base::TimeDelta max_rtcp_timeout =
133 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2); 134 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2);
134 testing_clock_->Advance(max_rtcp_timeout); 135 testing_clock_->Advance(max_rtcp_timeout);
135 task_runner_->RunTasks(); 136 task_runner_->RunTasks();
136 EXPECT_LE(1, transport_.number_of_rtp_packets()); 137 EXPECT_LE(1, transport_.number_of_rtp_packets());
137 EXPECT_LE(1, transport_.number_of_rtcp_packets()); 138 EXPECT_LE(1, transport_.number_of_rtcp_packets());
138 } 139 }
139 140
140 } // namespace cast 141 } // namespace cast
141 } // namespace media 142 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698