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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 }; | 123 }; |
124 std::queue<Expectation> expectations_; | 124 std::queue<Expectation> expectations_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(MetadataRecorder); | 126 DISALLOW_COPY_AND_ASSIGN(MetadataRecorder); |
127 }; | 127 }; |
128 | 128 |
129 class EndToEndFrameChecker | 129 class EndToEndFrameChecker |
130 : public base::RefCountedThreadSafe<EndToEndFrameChecker> { | 130 : public base::RefCountedThreadSafe<EndToEndFrameChecker> { |
131 public: | 131 public: |
132 explicit EndToEndFrameChecker(const VideoDecoderConfig& config) | 132 explicit EndToEndFrameChecker(const VideoDecoderConfig& config) |
133 : decoder_(make_scoped_refptr(new media::MediaLog())), | 133 : decoder_(&media_log_), count_frames_checked_(0) { |
134 count_frames_checked_(0) { | |
135 bool decoder_init_result; | 134 bool decoder_init_result; |
136 decoder_.Initialize( | 135 decoder_.Initialize( |
137 config, false, nullptr, | 136 config, false, nullptr, |
138 base::Bind(&SaveDecoderInitResult, &decoder_init_result), | 137 base::Bind(&SaveDecoderInitResult, &decoder_init_result), |
139 base::Bind(&EndToEndFrameChecker::CompareFrameWithExpected, | 138 base::Bind(&EndToEndFrameChecker::CompareFrameWithExpected, |
140 base::Unretained(this))); | 139 base::Unretained(this))); |
141 base::RunLoop().RunUntilIdle(); | 140 base::RunLoop().RunUntilIdle(); |
142 EXPECT_TRUE(decoder_init_result); | 141 EXPECT_TRUE(decoder_init_result); |
143 } | 142 } |
144 | 143 |
(...skipping 17 matching lines...) Expand all Loading... |
162 } | 161 } |
163 | 162 |
164 void DecodeDone(DecodeStatus status) { EXPECT_EQ(DecodeStatus::OK, status); } | 163 void DecodeDone(DecodeStatus status) { EXPECT_EQ(DecodeStatus::OK, status); } |
165 | 164 |
166 int count_frames_checked() const { return count_frames_checked_; } | 165 int count_frames_checked() const { return count_frames_checked_; } |
167 | 166 |
168 private: | 167 private: |
169 friend class base::RefCountedThreadSafe<EndToEndFrameChecker>; | 168 friend class base::RefCountedThreadSafe<EndToEndFrameChecker>; |
170 virtual ~EndToEndFrameChecker() {} | 169 virtual ~EndToEndFrameChecker() {} |
171 | 170 |
| 171 MediaLog media_log_; |
172 FFmpegVideoDecoder decoder_; | 172 FFmpegVideoDecoder decoder_; |
173 std::queue<scoped_refptr<VideoFrame>> expectations_; | 173 std::queue<scoped_refptr<VideoFrame>> expectations_; |
174 int count_frames_checked_; | 174 int count_frames_checked_; |
175 | 175 |
176 DISALLOW_COPY_AND_ASSIGN(EndToEndFrameChecker); | 176 DISALLOW_COPY_AND_ASSIGN(EndToEndFrameChecker); |
177 }; | 177 }; |
178 | 178 |
179 void CreateFrameAndMemsetPlane(VideoFrameFactory* const video_frame_factory) { | 179 void CreateFrameAndMemsetPlane(VideoFrameFactory* const video_frame_factory) { |
180 const scoped_refptr<media::VideoFrame> video_frame = | 180 const scoped_refptr<media::VideoFrame> video_frame = |
181 video_frame_factory->MaybeCreateFrame( | 181 video_frame_factory->MaybeCreateFrame( |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta())); | 407 gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta())); |
408 | 408 |
409 // After a power resume event, the factory should produce frames right away | 409 // After a power resume event, the factory should produce frames right away |
410 // because the encoder re-initializes on its own. | 410 // because the encoder re-initializes on its own. |
411 power_source_->GenerateResumeEvent(); | 411 power_source_->GenerateResumeEvent(); |
412 CreateFrameAndMemsetPlane(video_frame_factory.get()); | 412 CreateFrameAndMemsetPlane(video_frame_factory.get()); |
413 } | 413 } |
414 | 414 |
415 } // namespace cast | 415 } // namespace cast |
416 } // namespace media | 416 } // namespace media |
OLD | NEW |