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 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or | 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or |
8 // Win/EGL. | 8 // Win/EGL. |
9 // - ClientState is an enum for the state of the decode client used by the test. | 9 // - ClientState is an enum for the state of the decode client used by the test. |
10 // - ClientStateNotification is a barrier abstraction that allows the test code | 10 // - ClientStateNotification is a barrier abstraction that allows the test code |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 // - |profile| is the media::VideoCodecProfile set during Initialization. | 81 // - |profile| is the media::VideoCodecProfile set during Initialization. |
82 // An empty value for a numeric field means "ignore". | 82 // An empty value for a numeric field means "ignore". |
83 const base::FilePath::CharType* test_video_data = | 83 const base::FilePath::CharType* test_video_data = |
84 // FILE_PATH_LITERAL("test-25fps.vp8:320:240:250:250:50:175:11"); | 84 // FILE_PATH_LITERAL("test-25fps.vp8:320:240:250:250:50:175:11"); |
85 FILE_PATH_LITERAL("test-25fps.h264:320:240:250:258:50:175:1"); | 85 FILE_PATH_LITERAL("test-25fps.h264:320:240:250:258:50:175:1"); |
86 | 86 |
87 // The path of the frame delivery time log. We can enable the log and specify | 87 // The path of the frame delivery time log. We can enable the log and specify |
88 // the filename by the "--frame_delivery_log" switch. | 88 // the filename by the "--frame_delivery_log" switch. |
89 const base::FilePath::CharType* frame_delivery_log = NULL; | 89 const base::FilePath::CharType* frame_delivery_log = NULL; |
90 | 90 |
91 // The value is set by the switch "--rendering_fps". | |
92 double rendering_fps = 0; | |
93 | |
94 // Disable rendering, the value is set by the switch "--disable_rendering". | |
95 bool disable_rendering = false; | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
This is not mentioned in the CL description.
Owen Lin
2013/07/31 10:01:36
Done.
| |
96 | |
91 // Magic constants for differentiating the reasons for NotifyResetDone being | 97 // Magic constants for differentiating the reasons for NotifyResetDone being |
92 // called. | 98 // called. |
93 enum ResetPoint { | 99 enum ResetPoint { |
94 MID_STREAM_RESET = -2, | 100 MID_STREAM_RESET = -2, |
95 END_OF_STREAM_RESET = -1 | 101 END_OF_STREAM_RESET = -1 |
96 }; | 102 }; |
97 | 103 |
98 const int kMaxResetAfterFrameNum = 100; | 104 const int kMaxResetAfterFrameNum = 100; |
99 const int kMaxFramesToDelayReuse = 64; | 105 const int kMaxFramesToDelayReuse = 64; |
100 const int kReuseDelayMs = 1000; | 106 const int kReuseDelayMs = 1000; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 } | 186 } |
181 | 187 |
182 // State of the GLRenderingVDAClient below. Order matters here as the test | 188 // State of the GLRenderingVDAClient below. Order matters here as the test |
183 // makes assumptions about it. | 189 // makes assumptions about it. |
184 enum ClientState { | 190 enum ClientState { |
185 CS_CREATED = 0, | 191 CS_CREATED = 0, |
186 CS_DECODER_SET = 1, | 192 CS_DECODER_SET = 1, |
187 CS_INITIALIZED = 2, | 193 CS_INITIALIZED = 2, |
188 CS_FLUSHING = 3, | 194 CS_FLUSHING = 3, |
189 CS_FLUSHED = 4, | 195 CS_FLUSHED = 4, |
190 CS_DONE = 5, | 196 CS_RESETTING = 5, |
191 CS_RESETTING = 6, | 197 CS_RESET = 6, |
192 CS_RESET = 7, | 198 CS_ERROR = 7, |
193 CS_ERROR = 8, | 199 CS_DESTROYED = 8, |
194 CS_DESTROYED = 9, | |
195 CS_MAX, // Must be last entry. | 200 CS_MAX, // Must be last entry. |
196 }; | 201 }; |
197 | 202 |
198 // Helper class allowing one thread to wait on a notification from another. | 203 // Helper class allowing one thread to wait on a notification from another. |
199 // If notifications come in faster than they are Wait()'d for, they are | 204 // If notifications come in faster than they are Wait()'d for, they are |
200 // accumulated (so exactly as many Wait() calls will unblock as Notify() calls | 205 // accumulated (so exactly as many Wait() calls will unblock as Notify() calls |
201 // were made, regardless of order). | 206 // were made, regardless of order). |
202 class ClientStateNotification { | 207 class ClientStateNotification { |
203 public: | 208 public: |
204 ClientStateNotification(); | 209 ClientStateNotification(); |
(...skipping 21 matching lines...) Expand all Loading... | |
226 | 231 |
227 ClientState ClientStateNotification::Wait() { | 232 ClientState ClientStateNotification::Wait() { |
228 base::AutoLock auto_lock(lock_); | 233 base::AutoLock auto_lock(lock_); |
229 while (pending_states_for_notification_.empty()) | 234 while (pending_states_for_notification_.empty()) |
230 cv_.Wait(); | 235 cv_.Wait(); |
231 ClientState ret = pending_states_for_notification_.front(); | 236 ClientState ret = pending_states_for_notification_.front(); |
232 pending_states_for_notification_.pop(); | 237 pending_states_for_notification_.pop(); |
233 return ret; | 238 return ret; |
234 } | 239 } |
235 | 240 |
241 class ThrottlingVDAClient : public VideoDecodeAccelerator::Client { | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
doco the point of this class.
Owen Lin
2013/07/31 10:01:36
Done.
| |
242 public: | |
243 // Callback invoked whan the picture is dropped and should be reused for | |
244 // the decoder again. | |
245 typedef base::Callback<void(int32 picture_buffer_id)> ReusePictureCB; | |
246 | |
247 ThrottlingVDAClient(VideoDecodeAccelerator::Client*, | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
missing param name
Owen Lin
2013/07/31 10:01:36
Done.
| |
248 double fps, | |
249 ReusePictureCB reuse_pic_cb); | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
s/pic/picture/
Owen Lin
2013/07/31 10:01:36
Done.
| |
250 virtual ~ThrottlingVDAClient(); | |
251 | |
252 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | |
253 const gfx::Size& dimensions, | |
254 uint32 texture_target) OVERRIDE; | |
255 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | |
256 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | |
257 | |
258 // Simple state changes. | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
What's so "simple" about them? :)
Generally chrome
Owen Lin
2013/07/31 10:01:36
I just copy the description from GLRenderingVDACli
| |
259 virtual void NotifyInitializeDone() OVERRIDE; | |
260 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; | |
261 virtual void NotifyFlushDone() OVERRIDE; | |
262 virtual void NotifyResetDone() OVERRIDE; | |
263 virtual void NotifyError(VideoDecodeAccelerator::Error error) OVERRIDE; | |
264 | |
265 int num_decoded_frames() { return num_decoded_frames_; } | |
266 | |
267 private: | |
268 VideoDecodeAccelerator::Client* client_; | |
269 ReusePictureCB reuse_pic_cb_; | |
270 base::TimeTicks last_frame_delivered_time_; | |
271 base::TimeDelta frame_duration_; | |
272 | |
273 int num_decoded_frames_; | |
274 int pending_pictures_; | |
275 | |
276 void CallClientPictureReady(const media::Picture& picture); | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
style: methods go above members
Owen Lin
2013/07/31 10:01:36
Done.
| |
277 }; | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
DISALLOW_IMPLICIT_CONSTRUCTORS
Owen Lin
2013/07/31 10:01:36
Done.
| |
278 | |
279 ThrottlingVDAClient::ThrottlingVDAClient( | |
280 VideoDecodeAccelerator::Client* client, | |
281 double fps, | |
282 ReusePictureCB reuse_pic_cb) | |
283 : client_(client), | |
284 reuse_pic_cb_(reuse_pic_cb), | |
285 num_decoded_frames_(0), | |
286 pending_pictures_(0) { | |
287 CHECK(client_); | |
288 CHECK_GT(fps, 0); | |
289 frame_duration_ = base::TimeDelta::FromSeconds(1) / fps; | |
290 } | |
291 | |
292 ThrottlingVDAClient::~ThrottlingVDAClient() {} | |
293 | |
294 void ThrottlingVDAClient::ProvidePictureBuffers( | |
295 uint32 requested_num_of_buffers, | |
296 const gfx::Size& dimensions, | |
297 uint32 texture_target) { | |
298 client_->ProvidePictureBuffers(requested_num_of_buffers, | |
299 dimensions, | |
300 texture_target); | |
301 } | |
302 | |
303 void ThrottlingVDAClient::DismissPictureBuffer(int32 picture_buffer_id) { | |
304 client_->DismissPictureBuffer(picture_buffer_id); | |
305 } | |
306 | |
307 void ThrottlingVDAClient::PictureReady(const media::Picture& picture) { | |
308 base::TimeTicks now = base::TimeTicks::Now(); | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
indent is off here and elsewhere.
Owen Lin
2013/07/31 10:01:36
Done.
| |
309 if (num_decoded_frames_ == 0) | |
310 last_frame_delivered_time_ = now; | |
311 else | |
312 last_frame_delivered_time_ += frame_duration_; | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
This var name doesn't make sense.
Is it supposed t
Owen Lin
2013/07/31 10:01:36
The code has been changed to address the NotifyRes
| |
313 | |
314 ++num_decoded_frames_; | |
315 | |
316 if (last_frame_delivered_time_ < now) { | |
317 // Frame dropped, skip rendering. | |
318 LOG(INFO) << "Frame dropped"; | |
319 last_frame_delivered_time_ += frame_duration_; | |
320 reuse_pic_cb_.Run(picture.picture_buffer_id()); | |
321 return; | |
322 } | |
323 ++pending_pictures_; | |
324 base::MessageLoop::current()->PostDelayedTask( | |
325 FROM_HERE, | |
326 base::Bind(&ThrottlingVDAClient::CallClientPictureReady, | |
327 base::Unretained(this), | |
328 picture), | |
329 last_frame_delivered_time_ - now); | |
330 } | |
331 | |
332 void ThrottlingVDAClient::CallClientPictureReady( | |
333 const media::Picture& picture) { | |
334 --pending_pictures_; | |
335 client_->PictureReady(picture); | |
336 } | |
337 | |
338 void ThrottlingVDAClient::NotifyInitializeDone() { | |
339 client_->NotifyInitializeDone(); | |
340 } | |
341 | |
342 void ThrottlingVDAClient::NotifyEndOfBitstreamBuffer( | |
343 int32 bitstream_buffer_id) { | |
344 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); | |
345 } | |
346 | |
347 void ThrottlingVDAClient::NotifyFlushDone() { | |
348 if (pending_pictures_ > 0) { | |
349 base::MessageLoop::current()->PostDelayedTask( | |
350 FROM_HERE, | |
351 base::Bind(&ThrottlingVDAClient::NotifyFlushDone, | |
352 base::Unretained(this)), | |
353 last_frame_delivered_time_ - base::TimeTicks::Now()); | |
354 return; | |
355 } | |
356 client_->NotifyFlushDone(); | |
357 } | |
358 | |
359 void ThrottlingVDAClient::NotifyResetDone() { | |
360 if (pending_pictures_ > 0) { | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
This delays reset for rendering, which is unlikely
Owen Lin
2013/07/31 10:01:36
Done.
| |
361 base::MessageLoop::current()->PostDelayedTask( | |
362 FROM_HERE, | |
363 base::Bind(&ThrottlingVDAClient::NotifyResetDone, | |
364 base::Unretained(this)), | |
365 last_frame_delivered_time_ - base::TimeTicks::Now()); | |
366 return; | |
367 } | |
368 client_->NotifyResetDone(); | |
369 } | |
370 | |
371 void ThrottlingVDAClient::NotifyError(VideoDecodeAccelerator::Error error) { | |
372 client_->NotifyError(error); | |
373 } | |
374 | |
236 // Client that can accept callbacks from a VideoDecodeAccelerator and is used by | 375 // Client that can accept callbacks from a VideoDecodeAccelerator and is used by |
237 // the TESTs below. | 376 // the TESTs below. |
238 class GLRenderingVDAClient : public VideoDecodeAccelerator::Client { | 377 class GLRenderingVDAClient : public VideoDecodeAccelerator::Client { |
239 public: | 378 public: |
240 // Doesn't take ownership of |rendering_helper| or |note|, which must outlive | 379 // Doesn't take ownership of |rendering_helper| or |note|, which must outlive |
241 // |*this|. | 380 // |*this|. |
242 // |num_fragments_per_decode| counts NALUs for h264 and frames for VP8. | 381 // |num_fragments_per_decode| counts NALUs for h264 and frames for VP8. |
243 // |num_play_throughs| indicates how many times to play through the video. | 382 // |num_play_throughs| indicates how many times to play through the video. |
244 // |reset_after_frame_num| can be a frame number >=0 indicating a mid-stream | 383 // |reset_after_frame_num| can be a frame number >=0 indicating a mid-stream |
245 // Reset() should be done after that frame number is delivered, or | 384 // Reset() should be done after that frame number is delivered, or |
246 // END_OF_STREAM_RESET to indicate no mid-stream Reset(). | 385 // END_OF_STREAM_RESET to indicate no mid-stream Reset(). |
247 // |delete_decoder_state| indicates when the underlying decoder should be | 386 // |delete_decoder_state| indicates when the underlying decoder should be |
248 // Destroy()'d and deleted and can take values: N<0: delete after -N Decode() | 387 // Destroy()'d and deleted and can take values: N<0: delete after -N Decode() |
249 // calls have been made, N>=0 means interpret as ClientState. | 388 // calls have been made, N>=0 means interpret as ClientState. |
250 // Both |reset_after_frame_num| & |delete_decoder_state| apply only to the | 389 // Both |reset_after_frame_num| & |delete_decoder_state| apply only to the |
251 // last play-through (governed by |num_play_throughs|). | 390 // last play-through (governed by |num_play_throughs|). |
391 // |rendering_fps| indicates the target rendering fps. 0 means no target fps | |
392 // and it would render as fast as possible. | |
393 // Use |suppress_rendering| to skip the rendering part, so it only decodes | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
Rewrite this line to match the rest of the paragra
Owen Lin
2013/07/31 10:01:36
Done.
| |
394 // the frames and won't shown on display. | |
252 // After |delay_reuse_after_frame_num| frame has been delivered, the client | 395 // After |delay_reuse_after_frame_num| frame has been delivered, the client |
253 // will start delaying the call to ReusePictureBuffer() for kReuseDelayMs. | 396 // will start delaying the call to ReusePictureBuffer() for kReuseDelayMs. |
254 GLRenderingVDAClient(RenderingHelper* rendering_helper, | 397 GLRenderingVDAClient(RenderingHelper* rendering_helper, |
255 int rendering_window_id, | 398 int rendering_window_id, |
256 ClientStateNotification* note, | 399 ClientStateNotification* note, |
257 const std::string& encoded_data, | 400 const std::string& encoded_data, |
258 int num_fragments_per_decode, | 401 int num_fragments_per_decode, |
259 int num_in_flight_decodes, | 402 int num_in_flight_decodes, |
260 int num_play_throughs, | 403 int num_play_throughs, |
261 int reset_after_frame_num, | 404 int reset_after_frame_num, |
262 int delete_decoder_state, | 405 int delete_decoder_state, |
263 int frame_width, | 406 int frame_width, |
264 int frame_height, | 407 int frame_height, |
265 int profile, | 408 int profile, |
409 double rendering_fps, | |
266 bool suppress_rendering, | 410 bool suppress_rendering, |
267 int delay_reuse_after_frame_num); | 411 int delay_reuse_after_frame_num); |
268 virtual ~GLRenderingVDAClient(); | 412 virtual ~GLRenderingVDAClient(); |
269 void CreateDecoder(); | 413 void CreateDecoder(); |
270 | 414 |
271 // VideoDecodeAccelerator::Client implementation. | 415 // VideoDecodeAccelerator::Client implementation. |
272 // The heart of the Client. | 416 // The heart of the Client. |
273 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 417 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
274 const gfx::Size& dimensions, | 418 const gfx::Size& dimensions, |
275 uint32 texture_target) OVERRIDE; | 419 uint32 texture_target) OVERRIDE; |
276 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | 420 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; |
277 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | 421 virtual void PictureReady(const media::Picture& picture) OVERRIDE; |
278 // Simple state changes. | 422 // Simple state changes. |
279 virtual void NotifyInitializeDone() OVERRIDE; | 423 virtual void NotifyInitializeDone() OVERRIDE; |
280 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; | 424 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; |
281 virtual void NotifyFlushDone() OVERRIDE; | 425 virtual void NotifyFlushDone() OVERRIDE; |
282 virtual void NotifyResetDone() OVERRIDE; | 426 virtual void NotifyResetDone() OVERRIDE; |
283 virtual void NotifyError(VideoDecodeAccelerator::Error error) OVERRIDE; | 427 virtual void NotifyError(VideoDecodeAccelerator::Error error) OVERRIDE; |
284 | 428 |
285 void OutputFrameDeliveryTimes(base::PlatformFile output); | 429 void OutputFrameDeliveryTimes(base::PlatformFile output); |
286 | 430 |
431 void NotifyFrameDropped(int32 picture_buffer_id); | |
432 | |
287 // Simple getters for inspecting the state of the Client. | 433 // Simple getters for inspecting the state of the Client. |
288 int num_done_bitstream_buffers() { return num_done_bitstream_buffers_; } | 434 int num_done_bitstream_buffers() { return num_done_bitstream_buffers_; } |
289 int num_skipped_fragments() { return num_skipped_fragments_; } | 435 int num_skipped_fragments() { return num_skipped_fragments_; } |
290 int num_queued_fragments() { return num_queued_fragments_; } | 436 int num_queued_fragments() { return num_queued_fragments_; } |
291 int num_decoded_frames() { return num_decoded_frames_; } | 437 int num_decoded_frames() { return num_decoded_frames_; } |
292 double frames_per_second(); | 438 double frames_per_second(); |
293 bool decoder_deleted() { return !decoder_.get(); } | 439 bool decoder_deleted() { return !decoder_.get(); } |
294 | 440 |
295 private: | 441 private: |
296 typedef std::map<int, media::PictureBuffer*> PictureBufferById; | 442 typedef std::map<int, media::PictureBuffer*> PictureBufferById; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 int num_skipped_fragments_; | 479 int num_skipped_fragments_; |
334 int num_queued_fragments_; | 480 int num_queued_fragments_; |
335 int num_decoded_frames_; | 481 int num_decoded_frames_; |
336 int num_done_bitstream_buffers_; | 482 int num_done_bitstream_buffers_; |
337 PictureBufferById picture_buffers_by_id_; | 483 PictureBufferById picture_buffers_by_id_; |
338 base::TimeTicks initialize_done_ticks_; | 484 base::TimeTicks initialize_done_ticks_; |
339 int profile_; | 485 int profile_; |
340 bool suppress_rendering_; | 486 bool suppress_rendering_; |
341 std::vector<base::TimeTicks> frame_delivery_times_; | 487 std::vector<base::TimeTicks> frame_delivery_times_; |
342 int delay_reuse_after_frame_num_; | 488 int delay_reuse_after_frame_num_; |
489 scoped_ptr<ThrottlingVDAClient> throttling_client_; | |
343 }; | 490 }; |
344 | 491 |
345 GLRenderingVDAClient::GLRenderingVDAClient( | 492 GLRenderingVDAClient::GLRenderingVDAClient( |
346 RenderingHelper* rendering_helper, | 493 RenderingHelper* rendering_helper, |
347 int rendering_window_id, | 494 int rendering_window_id, |
348 ClientStateNotification* note, | 495 ClientStateNotification* note, |
349 const std::string& encoded_data, | 496 const std::string& encoded_data, |
350 int num_fragments_per_decode, | 497 int num_fragments_per_decode, |
351 int num_in_flight_decodes, | 498 int num_in_flight_decodes, |
352 int num_play_throughs, | 499 int num_play_throughs, |
353 int reset_after_frame_num, | 500 int reset_after_frame_num, |
354 int delete_decoder_state, | 501 int delete_decoder_state, |
355 int frame_width, | 502 int frame_width, |
356 int frame_height, | 503 int frame_height, |
357 int profile, | 504 int profile, |
505 double rendering_fps, | |
358 bool suppress_rendering, | 506 bool suppress_rendering, |
359 int delay_reuse_after_frame_num) | 507 int delay_reuse_after_frame_num) |
360 : rendering_helper_(rendering_helper), | 508 : rendering_helper_(rendering_helper), |
361 rendering_window_id_(rendering_window_id), | 509 rendering_window_id_(rendering_window_id), |
362 encoded_data_(encoded_data), | 510 encoded_data_(encoded_data), |
363 num_fragments_per_decode_(num_fragments_per_decode), | 511 num_fragments_per_decode_(num_fragments_per_decode), |
364 num_in_flight_decodes_(num_in_flight_decodes), outstanding_decodes_(0), | 512 num_in_flight_decodes_(num_in_flight_decodes), outstanding_decodes_(0), |
365 encoded_data_next_pos_to_decode_(0), next_bitstream_buffer_id_(0), | 513 encoded_data_next_pos_to_decode_(0), next_bitstream_buffer_id_(0), |
366 note_(note), | 514 note_(note), |
367 remaining_play_throughs_(num_play_throughs), | 515 remaining_play_throughs_(num_play_throughs), |
368 reset_after_frame_num_(reset_after_frame_num), | 516 reset_after_frame_num_(reset_after_frame_num), |
369 delete_decoder_state_(delete_decoder_state), | 517 delete_decoder_state_(delete_decoder_state), |
370 state_(CS_CREATED), | 518 state_(CS_CREATED), |
371 num_skipped_fragments_(0), num_queued_fragments_(0), | 519 num_skipped_fragments_(0), num_queued_fragments_(0), |
372 num_decoded_frames_(0), num_done_bitstream_buffers_(0), | 520 num_decoded_frames_(0), num_done_bitstream_buffers_(0), |
373 profile_(profile), | 521 profile_(profile), |
374 suppress_rendering_(suppress_rendering), | 522 suppress_rendering_(suppress_rendering), |
375 delay_reuse_after_frame_num_(delay_reuse_after_frame_num) { | 523 delay_reuse_after_frame_num_(delay_reuse_after_frame_num) { |
376 CHECK_GT(num_fragments_per_decode, 0); | 524 CHECK_GT(num_fragments_per_decode, 0); |
377 CHECK_GT(num_in_flight_decodes, 0); | 525 CHECK_GT(num_in_flight_decodes, 0); |
378 CHECK_GT(num_play_throughs, 0); | 526 CHECK_GT(num_play_throughs, 0); |
527 CHECK_GE(rendering_fps, 0); | |
528 if (rendering_fps > 0) | |
529 throttling_client_.reset(new ThrottlingVDAClient( | |
530 this, | |
531 rendering_fps, | |
532 base::Bind(&GLRenderingVDAClient::NotifyFrameDropped, | |
533 base::Unretained(this)))); | |
379 } | 534 } |
380 | 535 |
381 GLRenderingVDAClient::~GLRenderingVDAClient() { | 536 GLRenderingVDAClient::~GLRenderingVDAClient() { |
382 DeleteDecoder(); // Clean up in case of expected error. | 537 DeleteDecoder(); // Clean up in case of expected error. |
383 CHECK(decoder_deleted()); | 538 CHECK(decoder_deleted()); |
384 STLDeleteValues(&picture_buffers_by_id_); | 539 STLDeleteValues(&picture_buffers_by_id_); |
385 SetState(CS_DESTROYED); | 540 SetState(CS_DESTROYED); |
386 } | 541 } |
387 | 542 |
388 static bool DoNothingReturnTrue() { return true; } | 543 static bool DoNothingReturnTrue() { return true; } |
389 | 544 |
390 void GLRenderingVDAClient::CreateDecoder() { | 545 void GLRenderingVDAClient::CreateDecoder() { |
391 CHECK(decoder_deleted()); | 546 CHECK(decoder_deleted()); |
392 CHECK(!decoder_.get()); | 547 CHECK(!decoder_.get()); |
548 | |
549 VideoDecodeAccelerator::Client* client = this; | |
550 if (throttling_client_) | |
551 client = throttling_client_.get(); | |
393 #if defined(OS_WIN) | 552 #if defined(OS_WIN) |
394 decoder_.reset(new DXVAVideoDecodeAccelerator( | 553 decoder_.reset(new DXVAVideoDecodeAccelerator( |
395 this, base::Bind(&DoNothingReturnTrue))); | 554 client, base::Bind(&DoNothingReturnTrue))); |
396 #elif defined(OS_CHROMEOS) | 555 #elif defined(OS_CHROMEOS) |
397 #if defined(ARCH_CPU_ARMEL) | 556 #if defined(ARCH_CPU_ARMEL) |
398 decoder_.reset( | 557 decoder_.reset( |
399 new ExynosVideoDecodeAccelerator( | 558 new ExynosVideoDecodeAccelerator( |
400 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), | 559 static_cast<EGLDisplay>(rendering_helper_->GetGLDisplay()), |
401 static_cast<EGLContext>(rendering_helper_->GetGLContext()), | 560 static_cast<EGLContext>(rendering_helper_->GetGLContext()), |
402 this, base::Bind(&DoNothingReturnTrue))); | 561 client, base::Bind(&DoNothingReturnTrue))); |
403 #elif defined(ARCH_CPU_X86_FAMILY) | 562 #elif defined(ARCH_CPU_X86_FAMILY) |
404 decoder_.reset(new VaapiVideoDecodeAccelerator( | 563 decoder_.reset(new VaapiVideoDecodeAccelerator( |
405 static_cast<Display*>(rendering_helper_->GetGLDisplay()), | 564 static_cast<Display*>(rendering_helper_->GetGLDisplay()), |
406 static_cast<GLXContext>(rendering_helper_->GetGLContext()), | 565 static_cast<GLXContext>(rendering_helper_->GetGLContext()), |
407 this, base::Bind(&DoNothingReturnTrue))); | 566 client, base::Bind(&DoNothingReturnTrue))); |
408 #endif // ARCH_CPU_ARMEL | 567 #endif // ARCH_CPU_ARMEL |
409 #endif // OS_WIN | 568 #endif // OS_WIN |
410 CHECK(decoder_.get()); | 569 CHECK(decoder_.get()); |
411 SetState(CS_DECODER_SET); | 570 SetState(CS_DECODER_SET); |
412 if (decoder_deleted()) | 571 if (decoder_deleted()) |
413 return; | 572 return; |
414 | 573 |
415 // Configure the decoder. | 574 // Configure the decoder. |
416 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; | 575 media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; |
417 if (profile_ != -1) | 576 if (profile_ != -1) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 delete it->second; | 611 delete it->second; |
453 picture_buffers_by_id_.erase(it); | 612 picture_buffers_by_id_.erase(it); |
454 } | 613 } |
455 | 614 |
456 void GLRenderingVDAClient::PictureReady(const media::Picture& picture) { | 615 void GLRenderingVDAClient::PictureReady(const media::Picture& picture) { |
457 // We shouldn't be getting pictures delivered after Reset has completed. | 616 // We shouldn't be getting pictures delivered after Reset has completed. |
458 CHECK_LT(state_, CS_RESET); | 617 CHECK_LT(state_, CS_RESET); |
459 | 618 |
460 if (decoder_deleted()) | 619 if (decoder_deleted()) |
461 return; | 620 return; |
621 | |
462 frame_delivery_times_.push_back(base::TimeTicks::Now()); | 622 frame_delivery_times_.push_back(base::TimeTicks::Now()); |
463 | 623 |
464 CHECK_LE(picture.bitstream_buffer_id(), next_bitstream_buffer_id_); | |
465 ++num_decoded_frames_; | |
466 | |
467 // Mid-stream reset applies only to the last play-through per constructor | 624 // Mid-stream reset applies only to the last play-through per constructor |
468 // comment. | 625 // comment. |
469 if (remaining_play_throughs_ == 1 && | 626 if (remaining_play_throughs_ == 1 && |
470 reset_after_frame_num_ == num_decoded_frames_) { | 627 reset_after_frame_num_ == num_decoded_frames_) { |
471 reset_after_frame_num_ = MID_STREAM_RESET; | 628 reset_after_frame_num_ = MID_STREAM_RESET; |
472 decoder_->Reset(); | 629 decoder_->Reset(); |
473 // Re-start decoding from the beginning of the stream to avoid needing to | 630 // Re-start decoding from the beginning of the stream to avoid needing to |
474 // know how to find I-frames and so on in this test. | 631 // know how to find I-frames and so on in this test. |
475 encoded_data_next_pos_to_decode_ = 0; | 632 encoded_data_next_pos_to_decode_ = 0; |
476 } | 633 } |
477 | 634 |
635 CHECK_LE(picture.bitstream_buffer_id(), next_bitstream_buffer_id_); | |
636 ++num_decoded_frames_; | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
Why did you move these two lines?
Owen Lin
2013/07/31 10:01:36
Move them back.
| |
637 | |
478 media::PictureBuffer* picture_buffer = | 638 media::PictureBuffer* picture_buffer = |
479 picture_buffers_by_id_[picture.picture_buffer_id()]; | 639 picture_buffers_by_id_[picture.picture_buffer_id()]; |
480 CHECK(picture_buffer); | 640 CHECK(picture_buffer); |
481 if (!suppress_rendering_) { | 641 if (!suppress_rendering_) { |
482 rendering_helper_->RenderTexture(picture_buffer->texture_id()); | 642 rendering_helper_->RenderTexture(picture_buffer->texture_id()); |
483 } | 643 } |
484 | |
485 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { | 644 if (num_decoded_frames_ > delay_reuse_after_frame_num_) { |
486 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind( | 645 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind( |
487 &VideoDecodeAccelerator::ReusePictureBuffer, | 646 &VideoDecodeAccelerator::ReusePictureBuffer, |
488 base::Unretained(decoder_.get()), picture.picture_buffer_id()), | 647 decoder_->AsWeakPtr(), picture.picture_buffer_id()), |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
Should be gone after rebase?
Owen Lin
2013/07/31 10:01:36
Yes. It should be gone.
| |
489 base::TimeDelta::FromMilliseconds(kReuseDelayMs)); | 648 base::TimeDelta::FromMilliseconds(kReuseDelayMs)); |
490 } else { | 649 } else { |
491 decoder_->ReusePictureBuffer(picture.picture_buffer_id()); | 650 decoder_->ReusePictureBuffer(picture.picture_buffer_id()); |
492 } | 651 } |
493 } | 652 } |
494 | 653 |
495 void GLRenderingVDAClient::NotifyInitializeDone() { | 654 void GLRenderingVDAClient::NotifyInitializeDone() { |
496 SetState(CS_INITIALIZED); | 655 SetState(CS_INITIALIZED); |
497 initialize_done_ticks_ = base::TimeTicks::Now(); | 656 initialize_done_ticks_ = base::TimeTicks::Now(); |
498 for (int i = 0; i < num_in_flight_decodes_; ++i) | 657 for (int i = 0; i < num_in_flight_decodes_; ++i) |
499 DecodeNextFragments(); | 658 DecodeNextFragments(); |
500 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); | 659 DCHECK_EQ(outstanding_decodes_, num_in_flight_decodes_); |
501 } | 660 } |
502 | 661 |
503 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( | 662 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( |
504 int32 bitstream_buffer_id) { | 663 int32 bitstream_buffer_id) { |
505 // TODO(fischman): this test currently relies on this notification to make | 664 // TODO(fischman): this test currently relies on this notification to make |
506 // forward progress during a Reset(). But the VDA::Reset() API doesn't | 665 // forward progress during a Reset(). But the VDA::Reset() API doesn't |
507 // guarantee this, so stop relying on it (and remove the notifications from | 666 // guarantee this, so stop relying on it (and remove the notifications from |
508 // VaapiVideoDecodeAccelerator::FinishReset()). | 667 // VaapiVideoDecodeAccelerator::FinishReset()). |
509 ++num_done_bitstream_buffers_; | 668 ++num_done_bitstream_buffers_; |
510 --outstanding_decodes_; | 669 --outstanding_decodes_; |
511 DecodeNextFragments(); | 670 // Don't decode if it is in mid-stream resetting |
671 if (reset_after_frame_num_ != MID_STREAM_RESET) | |
Owen Lin
2013/07/24 06:30:45
This is for the MidStreamReset test case.
In the
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
See comment above; I think you don't want this and
Owen Lin
2013/07/31 10:01:36
Done.
| |
672 DecodeNextFragments(); | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
AFAICT the point of this CL is to slow down decode
Owen Lin
2013/07/31 10:01:36
Done.
| |
512 } | 673 } |
513 | 674 |
514 void GLRenderingVDAClient::NotifyFlushDone() { | 675 void GLRenderingVDAClient::NotifyFlushDone() { |
515 if (decoder_deleted()) | 676 if (decoder_deleted()) |
516 return; | 677 return; |
517 SetState(CS_FLUSHED); | 678 SetState(CS_FLUSHED); |
518 --remaining_play_throughs_; | 679 --remaining_play_throughs_; |
519 DCHECK_GE(remaining_play_throughs_, 0); | 680 DCHECK_GE(remaining_play_throughs_, 0); |
520 if (decoder_deleted()) | |
521 return; | |
522 decoder_->Reset(); | 681 decoder_->Reset(); |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
Why do you no longer need the decoder_deleted() gu
Owen Lin
2013/07/31 10:01:36
Oops, reverted. I didn't notice that decoder would
| |
523 SetState(CS_RESETTING); | 682 SetState(CS_RESETTING); |
524 } | 683 } |
525 | 684 |
526 void GLRenderingVDAClient::NotifyResetDone() { | 685 void GLRenderingVDAClient::NotifyResetDone() { |
527 if (decoder_deleted()) | 686 if (decoder_deleted()) |
528 return; | 687 return; |
529 | 688 |
530 if (reset_after_frame_num_ == MID_STREAM_RESET) { | 689 if (reset_after_frame_num_ == MID_STREAM_RESET) { |
531 reset_after_frame_num_ = END_OF_STREAM_RESET; | 690 reset_after_frame_num_ = END_OF_STREAM_RESET; |
532 DecodeNextFragments(); | 691 DecodeNextFragments(); |
(...skipping 22 matching lines...) Expand all Loading... | |
555 base::TimeTicks t0 = initialize_done_ticks_; | 714 base::TimeTicks t0 = initialize_done_ticks_; |
556 for (size_t i = 0; i < frame_delivery_times_.size(); ++i) { | 715 for (size_t i = 0; i < frame_delivery_times_.size(); ++i) { |
557 s = base::StringPrintf("frame %04" PRIuS ": %" PRId64 " us\n", | 716 s = base::StringPrintf("frame %04" PRIuS ": %" PRId64 " us\n", |
558 i, | 717 i, |
559 (frame_delivery_times_[i] - t0).InMicroseconds()); | 718 (frame_delivery_times_[i] - t0).InMicroseconds()); |
560 t0 = frame_delivery_times_[i]; | 719 t0 = frame_delivery_times_[i]; |
561 base::WritePlatformFileAtCurrentPos(output, s.data(), s.length()); | 720 base::WritePlatformFileAtCurrentPos(output, s.data(), s.length()); |
562 } | 721 } |
563 } | 722 } |
564 | 723 |
724 void GLRenderingVDAClient::NotifyFrameDropped(int32 picture_buffer_id) { | |
725 decoder_->ReusePictureBuffer(picture_buffer_id); | |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
Shouldn't this be counting dropped frames or somet
Owen Lin
2013/07/31 10:01:36
I plan to derive the number of dropped frame from
| |
726 } | |
727 | |
565 static bool LookingAtNAL(const std::string& encoded, size_t pos) { | 728 static bool LookingAtNAL(const std::string& encoded, size_t pos) { |
566 return encoded[pos] == 0 && encoded[pos + 1] == 0 && | 729 return encoded[pos] == 0 && encoded[pos + 1] == 0 && |
567 encoded[pos + 2] == 0 && encoded[pos + 3] == 1; | 730 encoded[pos + 2] == 0 && encoded[pos + 3] == 1; |
568 } | 731 } |
569 | 732 |
570 void GLRenderingVDAClient::SetState(ClientState new_state) { | 733 void GLRenderingVDAClient::SetState(ClientState new_state) { |
571 note_->Notify(new_state); | 734 note_->Notify(new_state); |
572 state_ = new_state; | 735 state_ = new_state; |
573 if (!remaining_play_throughs_ && new_state == delete_decoder_state_) { | 736 if (!remaining_play_throughs_ && new_state == delete_decoder_state_) { |
574 CHECK(!decoder_deleted()); | 737 CHECK(!decoder_deleted()); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 // - whether to test slow rendering by delaying ReusePictureBuffer(). | 881 // - whether to test slow rendering by delaying ReusePictureBuffer(). |
719 class VideoDecodeAcceleratorTest | 882 class VideoDecodeAcceleratorTest |
720 : public ::testing::TestWithParam< | 883 : public ::testing::TestWithParam< |
721 Tuple7<int, int, int, int, ResetPoint, ClientState, bool> > { | 884 Tuple7<int, int, int, int, ResetPoint, ClientState, bool> > { |
722 }; | 885 }; |
723 | 886 |
724 // Helper so that gtest failures emit a more readable version of the tuple than | 887 // Helper so that gtest failures emit a more readable version of the tuple than |
725 // its byte representation. | 888 // its byte representation. |
726 ::std::ostream& operator<<( | 889 ::std::ostream& operator<<( |
727 ::std::ostream& os, | 890 ::std::ostream& os, |
728 const Tuple6<int, int, int, int, ResetPoint, ClientState>& t) { | 891 const Tuple7<int, int, int, int, ResetPoint, ClientState, bool>& t) { |
729 return os << t.a << ", " << t.b << ", " << t.c << ", " << t.d << ", " << t.e | 892 return os << t.a << ", " << t.b << ", " << t.c << ", " << t.d << ", " << t.e |
730 << ", " << t.f; | 893 << ", " << t.f << ", " << t.g; |
731 } | 894 } |
732 | 895 |
733 // Wait for |note| to report a state and if it's not |expected_state| then | 896 // Wait for |note| to report a state and if it's not |expected_state| then |
734 // assert |client| has deleted its decoder. | 897 // assert |client| has deleted its decoder. |
735 static void AssertWaitForStateOrDeleted(ClientStateNotification* note, | 898 static void AssertWaitForStateOrDeleted(ClientStateNotification* note, |
736 GLRenderingVDAClient* client, | 899 GLRenderingVDAClient* client, |
737 ClientState expected_state) { | 900 ClientState expected_state) { |
738 ClientState state = note->Wait(); | 901 ClientState state = note->Wait(); |
739 if (state == expected_state) return; | 902 if (state == expected_state) return; |
740 ASSERT_TRUE(client->decoder_deleted()) | 903 ASSERT_TRUE(client->decoder_deleted()) |
741 << "Decoder not deleted but Wait() returned " << state | 904 << "Decoder not deleted but Wait() returned " << state |
742 << ", instead of " << expected_state; | 905 << ", instead of " << expected_state; |
743 } | 906 } |
744 | 907 |
745 // We assert a minimal number of concurrent decoders we expect to succeed. | 908 // We assert a minimal number of concurrent decoders we expect to succeed. |
746 // Different platforms can support more concurrent decoders, so we don't assert | 909 // Different platforms can support more concurrent decoders, so we don't assert |
747 // failure above this. | 910 // failure above this. |
748 enum { kMinSupportedNumConcurrentDecoders = 3 }; | 911 enum { kMinSupportedNumConcurrentDecoders = 3 }; |
749 | 912 |
750 // Test the most straightforward case possible: data is decoded from a single | 913 // Test the most straightforward case possible: data is decoded from a single |
751 // chunk and rendered to the screen. | 914 // chunk and rendered to the screen. |
752 TEST_P(VideoDecodeAcceleratorTest, TestSimpleDecode) { | 915 TEST_P(VideoDecodeAcceleratorTest, TestSimpleDecode) { |
753 // Can be useful for debugging VLOGs from OVDA. | |
754 // logging::SetMinLogLevel(-1); | |
755 | |
756 // Required for Thread to work. Not used otherwise. | 916 // Required for Thread to work. Not used otherwise. |
757 base::ShadowingAtExitManager at_exit_manager; | 917 base::ShadowingAtExitManager at_exit_manager; |
758 | 918 |
759 const int num_fragments_per_decode = GetParam().a; | 919 const int num_fragments_per_decode = GetParam().a; |
760 const size_t num_concurrent_decoders = GetParam().b; | 920 const size_t num_concurrent_decoders = GetParam().b; |
761 const size_t num_in_flight_decodes = GetParam().c; | 921 const size_t num_in_flight_decodes = GetParam().c; |
762 const int num_play_throughs = GetParam().d; | 922 const int num_play_throughs = GetParam().d; |
763 const int reset_point = GetParam().e; | 923 const int reset_point = GetParam().e; |
764 const int delete_decoder_state = GetParam().f; | 924 const int delete_decoder_state = GetParam().f; |
765 bool test_reuse_delay = GetParam().g; | 925 bool test_reuse_delay = GetParam().g; |
766 | 926 |
767 std::vector<TestVideoFile*> test_video_files; | 927 std::vector<TestVideoFile*> test_video_files; |
768 ParseAndReadTestVideoData(test_video_data, num_concurrent_decoders, | 928 ParseAndReadTestVideoData(test_video_data, num_concurrent_decoders, |
769 reset_point, &test_video_files); | 929 reset_point, &test_video_files); |
770 | 930 |
771 // Suppress GL rendering when we are logging the frame delivery time and a | 931 // Suppress GL rendering when we are logging the frame delivery time and a |
772 // few other tests, to cut down overall test runtime. | 932 // few other tests, to cut down overall test runtime. |
773 const bool suppress_rendering = num_fragments_per_decode > 1 || | 933 const bool suppress_rendering = num_fragments_per_decode > 1 || |
774 frame_delivery_log != NULL; | 934 content::disable_rendering; |
Ami GONE FROM CHROMIUM
2013/07/24 18:23:16
You dropped
frame_delivery_log != NULL
from the co
Owen Lin
2013/07/31 10:01:36
A new switch "--disable_rendering" was add in this
| |
775 | 935 |
776 std::vector<ClientStateNotification*> notes(num_concurrent_decoders, NULL); | 936 std::vector<ClientStateNotification*> notes(num_concurrent_decoders, NULL); |
777 std::vector<GLRenderingVDAClient*> clients(num_concurrent_decoders, NULL); | 937 std::vector<GLRenderingVDAClient*> clients(num_concurrent_decoders, NULL); |
778 | 938 |
779 // Initialize the rendering helper. | 939 // Initialize the rendering helper. |
780 base::Thread rendering_thread("GLRenderingVDAClientThread"); | 940 base::Thread rendering_thread("GLRenderingVDAClientThread"); |
781 base::Thread::Options options; | 941 base::Thread::Options options; |
782 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 942 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
783 #if defined(OS_WIN) | 943 #if defined(OS_WIN) |
784 // For windows the decoding thread initializes the media foundation decoder | 944 // For windows the decoding thread initializes the media foundation decoder |
(...skipping 29 matching lines...) Expand all Loading... | |
814 if (test_reuse_delay && | 974 if (test_reuse_delay && |
815 kMaxFramesToDelayReuse * 2 < video_file->num_frames) { | 975 kMaxFramesToDelayReuse * 2 < video_file->num_frames) { |
816 delay_after_frame_num = video_file->num_frames - kMaxFramesToDelayReuse; | 976 delay_after_frame_num = video_file->num_frames - kMaxFramesToDelayReuse; |
817 } | 977 } |
818 | 978 |
819 GLRenderingVDAClient* client = new GLRenderingVDAClient( | 979 GLRenderingVDAClient* client = new GLRenderingVDAClient( |
820 rendering_helper.get(), index, note, video_file->data_str, | 980 rendering_helper.get(), index, note, video_file->data_str, |
821 num_fragments_per_decode, num_in_flight_decodes, num_play_throughs, | 981 num_fragments_per_decode, num_in_flight_decodes, num_play_throughs, |
822 video_file->reset_after_frame_num, delete_decoder_state, | 982 video_file->reset_after_frame_num, delete_decoder_state, |
823 video_file->width, video_file->height, video_file->profile, | 983 video_file->width, video_file->height, video_file->profile, |
824 suppress_rendering, delay_after_frame_num); | 984 rendering_fps, suppress_rendering, delay_after_frame_num); |
825 clients[index] = client; | 985 clients[index] = client; |
826 | 986 |
827 rendering_thread.message_loop()->PostTask( | 987 rendering_thread.message_loop()->PostTask( |
828 FROM_HERE, | 988 FROM_HERE, |
829 base::Bind(&GLRenderingVDAClient::CreateDecoder, | 989 base::Bind(&GLRenderingVDAClient::CreateDecoder, |
830 base::Unretained(client))); | 990 base::Unretained(client))); |
831 | 991 |
832 ASSERT_EQ(note->Wait(), CS_DECODER_SET); | 992 ASSERT_EQ(note->Wait(), CS_DECODER_SET); |
833 } | 993 } |
834 // Then wait for all the decodes to finish. | 994 // Then wait for all the decodes to finish. |
(...skipping 18 matching lines...) Expand all Loading... | |
853 if (n > 0) { | 1013 if (n > 0) { |
854 ASSERT_NO_FATAL_FAILURE( | 1014 ASSERT_NO_FATAL_FAILURE( |
855 AssertWaitForStateOrDeleted(note, clients[i], CS_INITIALIZED)); | 1015 AssertWaitForStateOrDeleted(note, clients[i], CS_INITIALIZED)); |
856 } | 1016 } |
857 // InitializeDone kicks off decoding inside the client, so we just need to | 1017 // InitializeDone kicks off decoding inside the client, so we just need to |
858 // wait for Flush. | 1018 // wait for Flush. |
859 ASSERT_NO_FATAL_FAILURE( | 1019 ASSERT_NO_FATAL_FAILURE( |
860 AssertWaitForStateOrDeleted(note, clients[i], CS_FLUSHING)); | 1020 AssertWaitForStateOrDeleted(note, clients[i], CS_FLUSHING)); |
861 ASSERT_NO_FATAL_FAILURE( | 1021 ASSERT_NO_FATAL_FAILURE( |
862 AssertWaitForStateOrDeleted(note, clients[i], CS_FLUSHED)); | 1022 AssertWaitForStateOrDeleted(note, clients[i], CS_FLUSHED)); |
863 // FlushDone requests Reset(). | |
864 ASSERT_NO_FATAL_FAILURE( | 1023 ASSERT_NO_FATAL_FAILURE( |
865 AssertWaitForStateOrDeleted(note, clients[i], CS_RESETTING)); | 1024 AssertWaitForStateOrDeleted(note, clients[i], CS_RESETTING)); |
866 } | 1025 } |
867 ASSERT_NO_FATAL_FAILURE( | 1026 ASSERT_NO_FATAL_FAILURE( |
868 AssertWaitForStateOrDeleted(note, clients[i], CS_RESET)); | 1027 AssertWaitForStateOrDeleted(note, clients[i], CS_RESET)); |
1028 | |
869 // ResetDone requests Destroy(). | 1029 // ResetDone requests Destroy(). |
870 ASSERT_NO_FATAL_FAILURE( | 1030 ASSERT_NO_FATAL_FAILURE( |
871 AssertWaitForStateOrDeleted(note, clients[i], CS_DESTROYED)); | 1031 AssertWaitForStateOrDeleted(note, clients[i], CS_DESTROYED)); |
872 } | 1032 } |
873 // Finally assert that decoding went as expected. | 1033 // Finally assert that decoding went as expected. |
874 for (size_t i = 0; i < num_concurrent_decoders && | 1034 for (size_t i = 0; i < num_concurrent_decoders && |
875 !skip_performance_and_correctness_checks; ++i) { | 1035 !skip_performance_and_correctness_checks; ++i) { |
876 // We can only make performance/correctness assertions if the decoder was | 1036 // We can only make performance/correctness assertions if the decoder was |
877 // allowed to finish. | 1037 // allowed to finish. |
878 if (delete_decoder_state < CS_FLUSHED) | 1038 if (delete_decoder_state < CS_FLUSHED) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1032 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); | 1192 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); |
1033 it != switches.end(); ++it) { | 1193 it != switches.end(); ++it) { |
1034 if (it->first == "test_video_data") { | 1194 if (it->first == "test_video_data") { |
1035 content::test_video_data = it->second.c_str(); | 1195 content::test_video_data = it->second.c_str(); |
1036 continue; | 1196 continue; |
1037 } | 1197 } |
1038 if (it->first == "frame_delivery_log") { | 1198 if (it->first == "frame_delivery_log") { |
1039 content::frame_delivery_log = it->second.c_str(); | 1199 content::frame_delivery_log = it->second.c_str(); |
1040 continue; | 1200 continue; |
1041 } | 1201 } |
1202 if (it->first == "rendering_fps") { | |
1203 CHECK(base::StringToDouble(it->second, &content::rendering_fps)); | |
1204 continue; | |
1205 } | |
1206 if (it->first == "disable_rendering") { | |
1207 content::disable_rendering = true; | |
1208 continue; | |
1209 } | |
1042 if (it->first == "v" || it->first == "vmodule") | 1210 if (it->first == "v" || it->first == "vmodule") |
1043 continue; | 1211 continue; |
1044 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1212 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1045 } | 1213 } |
1046 | 1214 |
1047 base::ShadowingAtExitManager at_exit_manager; | 1215 base::ShadowingAtExitManager at_exit_manager; |
1048 | 1216 |
1049 #if defined(OS_WIN) | 1217 #if defined(OS_WIN) |
1050 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 1218 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
1051 #elif defined(OS_CHROMEOS) | 1219 #elif defined(OS_CHROMEOS) |
1052 #if defined(ARCH_CPU_ARMEL) | 1220 #if defined(ARCH_CPU_ARMEL) |
1053 content::ExynosVideoDecodeAccelerator::PreSandboxInitialization(); | 1221 content::ExynosVideoDecodeAccelerator::PreSandboxInitialization(); |
1054 #elif defined(ARCH_CPU_X86_FAMILY) | 1222 #elif defined(ARCH_CPU_X86_FAMILY) |
1055 content::VaapiWrapper::PreSandboxInitialization(); | 1223 content::VaapiWrapper::PreSandboxInitialization(); |
1056 #endif // ARCH_CPU_ARMEL | 1224 #endif // ARCH_CPU_ARMEL |
1057 #endif // OS_CHROMEOS | 1225 #endif // OS_CHROMEOS |
1058 | 1226 |
1059 return RUN_ALL_TESTS(); | 1227 return RUN_ALL_TESTS(); |
1060 } | 1228 } |
OLD | NEW |