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 <queue> | 5 #include <queue> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 argc, argv, | 58 argc, argv, |
59 base::Bind(&MediaTestSuite::Run, base::Unretained(&test_suite))); | 59 base::Bind(&MediaTestSuite::Run, base::Unretained(&test_suite))); |
60 } | 60 } |
61 | 61 |
62 namespace media { | 62 namespace media { |
63 namespace cast { | 63 namespace cast { |
64 | 64 |
65 // See comment in end2end_unittest.cc for details on this value. | 65 // See comment in end2end_unittest.cc for details on this value. |
66 const double kVideoAcceptedPSNR = 38.0; | 66 const double kVideoAcceptedPSNR = 38.0; |
67 | 67 |
68 void SavePipelineStatus(PipelineStatus* out_status, PipelineStatus in_status) { | 68 void SaveDecoderInitResult(bool* out_result, bool in_result) { |
69 *out_status = in_status; | 69 *out_result = in_result; |
70 } | 70 } |
71 | 71 |
72 void SaveOperationalStatus(OperationalStatus* out_status, | 72 void SaveOperationalStatus(OperationalStatus* out_status, |
73 OperationalStatus in_status) { | 73 OperationalStatus in_status) { |
74 *out_status = in_status; | 74 *out_status = in_status; |
75 } | 75 } |
76 | 76 |
77 class MetadataRecorder : public base::RefCountedThreadSafe<MetadataRecorder> { | 77 class MetadataRecorder : public base::RefCountedThreadSafe<MetadataRecorder> { |
78 public: | 78 public: |
79 MetadataRecorder() : count_frames_delivered_(0) {} | 79 MetadataRecorder() : count_frames_delivered_(0) {} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_(base::MessageLoop::current()->task_runner()), | 133 : decoder_(base::MessageLoop::current()->task_runner()), |
134 count_frames_checked_(0) { | 134 count_frames_checked_(0) { |
135 PipelineStatus pipeline_status; | 135 bool decoder_init_result; |
136 decoder_.Initialize( | 136 decoder_.Initialize( |
137 config, false, base::Bind(&SavePipelineStatus, &pipeline_status), | 137 config, false, base::Bind(&SaveDecoderInitResult, &decoder_init_result), |
138 base::Bind(&EndToEndFrameChecker::CompareFrameWithExpected, | 138 base::Bind(&EndToEndFrameChecker::CompareFrameWithExpected, |
139 base::Unretained(this))); | 139 base::Unretained(this))); |
140 base::MessageLoop::current()->RunUntilIdle(); | 140 base::MessageLoop::current()->RunUntilIdle(); |
141 EXPECT_EQ(PIPELINE_OK, pipeline_status); | 141 EXPECT_TRUE(decoder_init_result); |
142 } | 142 } |
143 | 143 |
144 void PushExpectation(const scoped_refptr<VideoFrame>& frame) { | 144 void PushExpectation(const scoped_refptr<VideoFrame>& frame) { |
145 expectations_.push(frame); | 145 expectations_.push(frame); |
146 } | 146 } |
147 | 147 |
148 void EncodeDone(scoped_ptr<SenderEncodedFrame> encoded_frame) { | 148 void EncodeDone(scoped_ptr<SenderEncodedFrame> encoded_frame) { |
149 auto buffer = DecoderBuffer::CopyFrom(encoded_frame->bytes(), | 149 auto buffer = DecoderBuffer::CopyFrom(encoded_frame->bytes(), |
150 encoded_frame->data.size()); | 150 encoded_frame->data.size()); |
151 decoder_.Decode(buffer, base::Bind(&EndToEndFrameChecker::DecodeDone, | 151 decoder_.Decode(buffer, base::Bind(&EndToEndFrameChecker::DecodeDone, |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta())); | 404 gfx::Size(kVideoWidth, kVideoHeight), base::TimeDelta())); |
405 | 405 |
406 // After a power resume event, the factory should produce frames right away | 406 // After a power resume event, the factory should produce frames right away |
407 // because the encoder re-initializes on its own. | 407 // because the encoder re-initializes on its own. |
408 power_source_->GenerateResumeEvent(); | 408 power_source_->GenerateResumeEvent(); |
409 CreateFrameAndMemsetPlane(video_frame_factory.get()); | 409 CreateFrameAndMemsetPlane(video_frame_factory.get()); |
410 } | 410 } |
411 | 411 |
412 } // namespace cast | 412 } // namespace cast |
413 } // namespace media | 413 } // namespace media |
OLD | NEW |