OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/test/pipeline_integration_test_base.h" | 5 #include "media/test/pipeline_integration_test_base.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 using ::testing::SaveArg; | 34 using ::testing::SaveArg; |
35 | 35 |
36 namespace media { | 36 namespace media { |
37 | 37 |
38 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e"; | 38 const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e"; |
39 const char kNullAudioHash[] = "0.00,0.00,0.00,0.00,0.00,0.00,"; | 39 const char kNullAudioHash[] = "0.00,0.00,0.00,0.00,0.00,0.00,"; |
40 | 40 |
41 PipelineIntegrationTestBase::PipelineIntegrationTestBase() | 41 PipelineIntegrationTestBase::PipelineIntegrationTestBase() |
42 : hashing_enabled_(false), | 42 : hashing_enabled_(false), |
43 clockless_playback_(false), | 43 clockless_playback_(false), |
44 pipeline_(new Pipeline(message_loop_.task_runner(), new MediaLog())), | 44 pipeline_(new PipelineImpl(message_loop_.task_runner(), new MediaLog())), |
45 ended_(false), | 45 ended_(false), |
46 pipeline_status_(PIPELINE_OK), | 46 pipeline_status_(PIPELINE_OK), |
47 last_video_frame_format_(PIXEL_FORMAT_UNKNOWN), | 47 last_video_frame_format_(PIXEL_FORMAT_UNKNOWN), |
48 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED), | 48 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED), |
49 hardware_config_(AudioParameters(), AudioParameters()) { | 49 hardware_config_(AudioParameters(), AudioParameters()) { |
50 base::MD5Init(&md5_context_); | 50 base::MD5Init(&md5_context_); |
51 } | 51 } |
52 | 52 |
53 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() { | 53 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() { |
54 if (!pipeline_->IsRunning()) | 54 if (!pipeline_->IsRunning()) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 EXPECT_CALL(*this, DecryptorAttached(true)); | 124 EXPECT_CALL(*this, DecryptorAttached(true)); |
125 pipeline_->SetCdm( | 125 pipeline_->SetCdm( |
126 cdm_context, base::Bind(&PipelineIntegrationTestBase::DecryptorAttached, | 126 cdm_context, base::Bind(&PipelineIntegrationTestBase::DecryptorAttached, |
127 base::Unretained(this))); | 127 base::Unretained(this))); |
128 } | 128 } |
129 | 129 |
130 // Should never be called as the required decryption keys for the encrypted | 130 // Should never be called as the required decryption keys for the encrypted |
131 // media files are provided in advance. | 131 // media files are provided in advance. |
132 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); | 132 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
133 | 133 |
| 134 scoped_ptr<Renderer> renderer = CreateRenderer(); |
134 pipeline_->Start( | 135 pipeline_->Start( |
135 demuxer_.get(), CreateRenderer(), | 136 demuxer_.get(), &renderer, |
136 base::Bind(&PipelineIntegrationTestBase::OnEnded, base::Unretained(this)), | 137 base::Bind(&PipelineIntegrationTestBase::OnEnded, base::Unretained(this)), |
137 base::Bind(&PipelineIntegrationTestBase::OnError, base::Unretained(this)), | 138 base::Bind(&PipelineIntegrationTestBase::OnError, base::Unretained(this)), |
138 base::Bind(&PipelineIntegrationTestBase::OnStatusCallback, | 139 base::Bind(&PipelineIntegrationTestBase::OnStatusCallback, |
139 base::Unretained(this)), | 140 base::Unretained(this)), |
140 base::Bind(&PipelineIntegrationTestBase::OnMetadata, | 141 base::Bind(&PipelineIntegrationTestBase::OnMetadata, |
141 base::Unretained(this)), | 142 base::Unretained(this)), |
142 base::Bind(&PipelineIntegrationTestBase::OnBufferingStateChanged, | 143 base::Bind(&PipelineIntegrationTestBase::OnBufferingStateChanged, |
143 base::Unretained(this)), | 144 base::Unretained(this)), |
144 base::Closure(), base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack, | 145 base::Closure(), base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack, |
145 base::Unretained(this)), | 146 base::Unretained(this)), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 base::Unretained(this))); | 181 base::Unretained(this))); |
181 message_loop_.Run(); | 182 message_loop_.Run(); |
182 return (pipeline_status_ == PIPELINE_OK); | 183 return (pipeline_status_ == PIPELINE_OK); |
183 } | 184 } |
184 | 185 |
185 bool PipelineIntegrationTestBase::Resume(base::TimeDelta seek_time) { | 186 bool PipelineIntegrationTestBase::Resume(base::TimeDelta seek_time) { |
186 ended_ = false; | 187 ended_ = false; |
187 | 188 |
188 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 189 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) |
189 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow)); | 190 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow)); |
190 pipeline_->Resume(CreateRenderer(), seek_time, | 191 scoped_ptr<Renderer> renderer = CreateRenderer(); |
| 192 pipeline_->Resume(&renderer, seek_time, |
191 base::Bind(&PipelineIntegrationTestBase::OnSeeked, | 193 base::Bind(&PipelineIntegrationTestBase::OnSeeked, |
192 base::Unretained(this), seek_time)); | 194 base::Unretained(this), seek_time)); |
193 message_loop_.Run(); | 195 message_loop_.Run(); |
194 return (pipeline_status_ == PIPELINE_OK); | 196 return (pipeline_status_ == PIPELINE_OK); |
195 } | 197 } |
196 | 198 |
197 void PipelineIntegrationTestBase::Stop() { | 199 void PipelineIntegrationTestBase::Stop() { |
198 DCHECK(pipeline_->IsRunning()); | 200 DCHECK(pipeline_->IsRunning()); |
199 pipeline_->Stop(base::MessageLoop::QuitWhenIdleClosure()); | 201 pipeline_->Stop(base::MessageLoop::QuitWhenIdleClosure()); |
200 message_loop_.Run(); | 202 message_loop_.Run(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 DCHECK(clockless_playback_); | 357 DCHECK(clockless_playback_); |
356 return clockless_audio_sink_->render_time(); | 358 return clockless_audio_sink_->render_time(); |
357 } | 359 } |
358 | 360 |
359 base::TimeTicks DummyTickClock::NowTicks() { | 361 base::TimeTicks DummyTickClock::NowTicks() { |
360 now_ += base::TimeDelta::FromSeconds(60); | 362 now_ += base::TimeDelta::FromSeconds(60); |
361 return now_; | 363 return now_; |
362 } | 364 } |
363 | 365 |
364 } // namespace media | 366 } // namespace media |
OLD | NEW |