| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 private: | 259 private: |
| 260 typedef std::map<int, media::PictureBuffer*> PictureBufferById; | 260 typedef std::map<int, media::PictureBuffer*> PictureBufferById; |
| 261 | 261 |
| 262 void SetState(ClientState new_state); | 262 void SetState(ClientState new_state); |
| 263 void FinishInitialization(); | 263 void FinishInitialization(); |
| 264 void ReturnPicture(int32 picture_buffer_id); | 264 void ReturnPicture(int32 picture_buffer_id); |
| 265 | 265 |
| 266 // Delete the associated decoder helper. | 266 // Delete the associated decoder helper. |
| 267 void DeleteDecoder(); | 267 void DeleteDecoder(); |
| 268 | 268 |
| 269 void ResetDecoder(); |
| 270 |
| 269 // Compute & return the first encoded bytes (including a start frame) to send | 271 // Compute & return the first encoded bytes (including a start frame) to send |
| 270 // to the decoder, starting at |start_pos| and returning one fragment. Skips | 272 // to the decoder, starting at |start_pos| and returning one fragment. Skips |
| 271 // to the first decodable position. | 273 // to the first decodable position. |
| 272 std::string GetBytesForFirstFragment(size_t start_pos, size_t* end_pos); | 274 std::string GetBytesForFirstFragment(size_t start_pos, size_t* end_pos); |
| 273 // Compute & return the encoded bytes of next fragment to send to the decoder | 275 // Compute & return the encoded bytes of next fragment to send to the decoder |
| 274 // (based on |start_pos|). | 276 // (based on |start_pos|). |
| 275 std::string GetBytesForNextFragment(size_t start_pos, size_t* end_pos); | 277 std::string GetBytesForNextFragment(size_t start_pos, size_t* end_pos); |
| 276 // Helpers for GetBytesForNextFragment above. | 278 // Helpers for GetBytesForNextFragment above. |
| 277 void GetBytesForNextNALU(size_t start_pos, size_t* end_pos); // For h.264. | 279 void GetBytesForNextNALU(size_t start_pos, size_t* end_pos); // For h.264. |
| 278 std::string GetBytesForNextFrame( | 280 std::string GetBytesForNextFrame( |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // TODO(fischman): this test currently relies on this notification to make | 528 // TODO(fischman): this test currently relies on this notification to make |
| 527 // forward progress during a Reset(). But the VDA::Reset() API doesn't | 529 // forward progress during a Reset(). But the VDA::Reset() API doesn't |
| 528 // guarantee this, so stop relying on it (and remove the notifications from | 530 // guarantee this, so stop relying on it (and remove the notifications from |
| 529 // VaapiVideoDecodeAccelerator::FinishReset()). | 531 // VaapiVideoDecodeAccelerator::FinishReset()). |
| 530 ++num_done_bitstream_buffers_; | 532 ++num_done_bitstream_buffers_; |
| 531 --outstanding_decodes_; | 533 --outstanding_decodes_; |
| 532 if (decode_calls_per_second_ == 0) | 534 if (decode_calls_per_second_ == 0) |
| 533 DecodeNextFragment(); | 535 DecodeNextFragment(); |
| 534 } | 536 } |
| 535 | 537 |
| 538 void GLRenderingVDAClient::ResetDecoder() { |
| 539 if (decoder_deleted()) |
| 540 return; |
| 541 decoder_->Reset(); |
| 542 SetState(CS_RESETTING); |
| 543 } |
| 544 |
| 536 void GLRenderingVDAClient::NotifyFlushDone() { | 545 void GLRenderingVDAClient::NotifyFlushDone() { |
| 537 if (decoder_deleted()) | 546 if (decoder_deleted()) |
| 538 return; | 547 return; |
| 539 | 548 |
| 540 SetState(CS_FLUSHED); | 549 SetState(CS_FLUSHED); |
| 541 --remaining_play_throughs_; | 550 --remaining_play_throughs_; |
| 542 DCHECK_GE(remaining_play_throughs_, 0); | 551 DCHECK_GE(remaining_play_throughs_, 0); |
| 543 if (decoder_deleted()) | 552 |
| 544 return; | 553 // Call Reset until rendering is completed. |
| 545 decoder_->Reset(); | 554 rendering_helper_->SetWaitRenderingCB( |
| 546 SetState(CS_RESETTING); | 555 window_id_, base::Bind(&GLRenderingVDAClient::ResetDecoder, AsWeakPtr())); |
| 547 } | 556 } |
| 548 | 557 |
| 549 void GLRenderingVDAClient::NotifyResetDone() { | 558 void GLRenderingVDAClient::NotifyResetDone() { |
| 550 if (decoder_deleted()) | 559 if (decoder_deleted()) |
| 551 return; | 560 return; |
| 552 | 561 |
| 553 rendering_helper_->ClearVideoFrames(window_id_); | 562 rendering_helper_->ClearVideoFrames(window_id_); |
| 554 | 563 |
| 555 if (reset_after_frame_num_ == MID_STREAM_RESET) { | 564 if (reset_after_frame_num_ == MID_STREAM_RESET) { |
| 556 reset_after_frame_num_ = END_OF_STREAM_RESET; | 565 reset_after_frame_num_ = END_OF_STREAM_RESET; |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 if (it->first == "v" || it->first == "vmodule") | 1423 if (it->first == "v" || it->first == "vmodule") |
| 1415 continue; | 1424 continue; |
| 1416 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1425 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1417 } | 1426 } |
| 1418 | 1427 |
| 1419 base::ShadowingAtExitManager at_exit_manager; | 1428 base::ShadowingAtExitManager at_exit_manager; |
| 1420 content::RenderingHelper::InitializeOneOff(); | 1429 content::RenderingHelper::InitializeOneOff(); |
| 1421 | 1430 |
| 1422 return RUN_ALL_TESTS(); | 1431 return RUN_ALL_TESTS(); |
| 1423 } | 1432 } |
| OLD | NEW |