OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <cstdlib> | 5 #include <cstdlib> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/synchronization/condition_variable.h" | 10 #include "base/synchronization/condition_variable.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "media/cast/cast_config.h" | 13 #include "media/cast/cast_config.h" |
14 #include "media/cast/receiver/video_decoder.h" | 14 #include "media/cast/receiver/video_decoder.h" |
15 #include "media/cast/sender/sender_encoded_frame.h" | |
16 #include "media/cast/sender/vp8_encoder.h" | 15 #include "media/cast/sender/vp8_encoder.h" |
17 #include "media/cast/test/utility/default_config.h" | 16 #include "media/cast/test/utility/default_config.h" |
18 #include "media/cast/test/utility/standalone_cast_environment.h" | 17 #include "media/cast/test/utility/standalone_cast_environment.h" |
19 #include "media/cast/test/utility/video_utility.h" | 18 #include "media/cast/test/utility/video_utility.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
21 | 20 |
22 namespace media { | 21 namespace media { |
23 namespace cast { | 22 namespace cast { |
24 | 23 |
25 namespace { | 24 namespace { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 next_frame_size_, | 77 next_frame_size_, |
79 gfx::Rect(next_frame_size_), | 78 gfx::Rect(next_frame_size_), |
80 next_frame_size_, | 79 next_frame_size_, |
81 next_frame_timestamp_); | 80 next_frame_timestamp_); |
82 const base::TimeTicks reference_time = | 81 const base::TimeTicks reference_time = |
83 base::TimeTicks::UnixEpoch() + next_frame_timestamp_; | 82 base::TimeTicks::UnixEpoch() + next_frame_timestamp_; |
84 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate; | 83 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate; |
85 PopulateVideoFrame(video_frame.get(), 0); | 84 PopulateVideoFrame(video_frame.get(), 0); |
86 | 85 |
87 // Encode |frame| into |encoded_frame->data|. | 86 // Encode |frame| into |encoded_frame->data|. |
88 scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); | 87 scoped_ptr<EncodedFrame> encoded_frame(new EncodedFrame()); |
89 // Test only supports VP8, currently. | 88 // Test only supports VP8, currently. |
90 CHECK_EQ(CODEC_VIDEO_VP8, GetParam()); | 89 CHECK_EQ(CODEC_VIDEO_VP8, GetParam()); |
91 vp8_encoder_.Encode(video_frame, reference_time, encoded_frame.get()); | 90 vp8_encoder_.Encode(video_frame, reference_time, encoded_frame.get()); |
92 // Rewrite frame IDs for testing purposes. | 91 // Rewrite frame IDs for testing purposes. |
93 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames; | 92 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames; |
94 if (encoded_frame->dependency == EncodedFrame::KEY) | 93 if (encoded_frame->dependency == EncodedFrame::KEY) |
95 encoded_frame->referenced_frame_id = encoded_frame->frame_id; | 94 encoded_frame->referenced_frame_id = encoded_frame->frame_id; |
96 else | 95 else |
97 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1; | 96 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1; |
98 last_frame_id_ = encoded_frame->frame_id; | 97 last_frame_id_ = encoded_frame->frame_id; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 222 |
224 WaitForAllVideoToBeDecoded(); | 223 WaitForAllVideoToBeDecoded(); |
225 } | 224 } |
226 | 225 |
227 INSTANTIATE_TEST_CASE_P(, | 226 INSTANTIATE_TEST_CASE_P(, |
228 VideoDecoderTest, | 227 VideoDecoderTest, |
229 ::testing::Values(CODEC_VIDEO_VP8)); | 228 ::testing::Values(CODEC_VIDEO_VP8)); |
230 | 229 |
231 } // namespace cast | 230 } // namespace cast |
232 } // namespace media | 231 } // namespace media |
OLD | NEW |