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

Side by Side Diff: media/cast/video_receiver/video_receiver_unittest.cc

Issue 288103002: [Cast] EncodedAudioFrame+EncodedVideoFrame+reference_time --> EncodedFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "media/cast/cast_defines.h" 9 #include "media/cast/cast_defines.h"
10 #include "media/cast/cast_environment.h" 10 #include "media/cast/cast_environment.h"
(...skipping 19 matching lines...) Expand all
30 FakeVideoClient() : num_called_(0) {} 30 FakeVideoClient() : num_called_(0) {}
31 virtual ~FakeVideoClient() {} 31 virtual ~FakeVideoClient() {}
32 32
33 void SetNextExpectedResult(uint32 expected_frame_id, 33 void SetNextExpectedResult(uint32 expected_frame_id,
34 const base::TimeTicks& expected_playout_time) { 34 const base::TimeTicks& expected_playout_time) {
35 expected_frame_id_ = expected_frame_id; 35 expected_frame_id_ = expected_frame_id;
36 expected_playout_time_ = expected_playout_time; 36 expected_playout_time_ = expected_playout_time;
37 } 37 }
38 38
39 void DeliverEncodedVideoFrame( 39 void DeliverEncodedVideoFrame(
40 scoped_ptr<transport::EncodedVideoFrame> video_frame, 40 scoped_ptr<transport::EncodedFrame> video_frame) {
41 const base::TimeTicks& playout_time) {
42 ASSERT_FALSE(!video_frame) 41 ASSERT_FALSE(!video_frame)
43 << "If at shutdown: There were unsatisfied requests enqueued."; 42 << "If at shutdown: There were unsatisfied requests enqueued.";
44 EXPECT_EQ(expected_frame_id_, video_frame->frame_id); 43 EXPECT_EQ(expected_frame_id_, video_frame->frame_id);
45 EXPECT_EQ(transport::kVp8, video_frame->codec); 44 EXPECT_EQ(expected_playout_time_, video_frame->reference_time);
46 EXPECT_EQ(expected_playout_time_, playout_time);
47 ++num_called_; 45 ++num_called_;
48 } 46 }
49 47
50 int number_times_called() const { return num_called_; } 48 int number_times_called() const { return num_called_; }
51 49
52 private: 50 private:
53 int num_called_; 51 int num_called_;
54 uint32 expected_frame_id_; 52 uint32 expected_frame_id_;
55 base::TimeTicks expected_playout_time_; 53 base::TimeTicks expected_playout_time_;
56 54
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_EQ(rtp_header_.rtp_timestamp, frame_events.begin()->rtp_timestamp); 147 EXPECT_EQ(rtp_header_.rtp_timestamp, frame_events.begin()->rtp_timestamp);
150 148
151 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber); 149 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber);
152 } 150 }
153 151
154 TEST_F(VideoReceiverTest, MultiplePendingGetCalls) { 152 TEST_F(VideoReceiverTest, MultiplePendingGetCalls) {
155 EXPECT_CALL(mock_transport_, SendRtcpPacket(_, _)) 153 EXPECT_CALL(mock_transport_, SendRtcpPacket(_, _))
156 .WillRepeatedly(testing::Return(true)); 154 .WillRepeatedly(testing::Return(true));
157 155
158 // Enqueue a request for an video frame. 156 // Enqueue a request for an video frame.
159 const VideoFrameEncodedCallback frame_encoded_callback = 157 const FrameEncodedCallback frame_encoded_callback =
160 base::Bind(&FakeVideoClient::DeliverEncodedVideoFrame, 158 base::Bind(&FakeVideoClient::DeliverEncodedVideoFrame,
161 base::Unretained(&fake_video_client_)); 159 base::Unretained(&fake_video_client_));
162 receiver_->GetEncodedVideoFrame(frame_encoded_callback); 160 receiver_->GetEncodedVideoFrame(frame_encoded_callback);
163 task_runner_->RunTasks(); 161 task_runner_->RunTasks();
164 EXPECT_EQ(0, fake_video_client_.number_times_called()); 162 EXPECT_EQ(0, fake_video_client_.number_times_called());
165 163
166 // Receive one video frame and expect to see the first request satisfied. 164 // Receive one video frame and expect to see the first request satisfied.
167 fake_video_client_.SetNextExpectedResult(kFirstFrameId, 165 fake_video_client_.SetNextExpectedResult(kFirstFrameId,
168 testing_clock_->NowTicks()); 166 testing_clock_->NowTicks());
169 const base::TimeTicks time_at_first_frame_feed = testing_clock_->NowTicks(); 167 const base::TimeTicks time_at_first_frame_feed = testing_clock_->NowTicks();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // Move forward another |rtp_max_delay_ms| and run any pending tasks (there 221 // Move forward another |rtp_max_delay_ms| and run any pending tasks (there
224 // should be none). Expect no additional frames where emitted. 222 // should be none). Expect no additional frames where emitted.
225 testing_clock_->Advance( 223 testing_clock_->Advance(
226 base::TimeDelta::FromMilliseconds(config_.rtp_max_delay_ms)); 224 base::TimeDelta::FromMilliseconds(config_.rtp_max_delay_ms));
227 task_runner_->RunTasks(); 225 task_runner_->RunTasks();
228 EXPECT_EQ(3, fake_video_client_.number_times_called()); 226 EXPECT_EQ(3, fake_video_client_.number_times_called());
229 } 227 }
230 228
231 } // namespace cast 229 } // namespace cast
232 } // namespace media 230 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_receiver/video_receiver.cc ('k') | media/cast/video_sender/codecs/vp8/vp8_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698