Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: content/common/gpu/media/video_decode_accelerator_unittest.cc

Issue 791573002: fix video_decode_accelerator_unittest issue when decode speed is slow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix video_decode_accelerator_unittest issue when decoding is slow Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 539 }
540 540
541 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( 541 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer(
542 int32 bitstream_buffer_id) { 542 int32 bitstream_buffer_id) {
543 // TODO(fischman): this test currently relies on this notification to make 543 // TODO(fischman): this test currently relies on this notification to make
544 // forward progress during a Reset(). But the VDA::Reset() API doesn't 544 // forward progress during a Reset(). But the VDA::Reset() API doesn't
545 // guarantee this, so stop relying on it (and remove the notifications from 545 // guarantee this, so stop relying on it (and remove the notifications from
546 // VaapiVideoDecodeAccelerator::FinishReset()). 546 // VaapiVideoDecodeAccelerator::FinishReset()).
547 ++num_done_bitstream_buffers_; 547 ++num_done_bitstream_buffers_;
548 --outstanding_decodes_; 548 --outstanding_decodes_;
549 if (decode_calls_per_second_ == 0) 549
550 // flush decoder after all BitstreamBuffer are processed
Pawel Osciak 2015/01/20 02:18:00 Comments should be full English sentences when pos
551 if (encoded_data_next_pos_to_decode_ == encoded_data_.size() &&
552 outstanding_decodes_ == 0) {
Pawel Osciak 2015/01/20 02:18:00 If the issue is with the decode being slow, should
Owen Lin 2015/01/20 02:43:00 The issue happens only when |decode_calls_per_seco
553 decoder_->Flush();
554 SetState(CS_FLUSHING);
555 } else if (decode_calls_per_second_ == 0)
550 DecodeNextFragment(); 556 DecodeNextFragment();
551 } 557 }
552 558
553 void GLRenderingVDAClient::NotifyFlushDone() { 559 void GLRenderingVDAClient::NotifyFlushDone() {
554 if (decoder_deleted()) 560 if (decoder_deleted())
555 return; 561 return;
556 562
557 SetState(CS_FLUSHED); 563 SetState(CS_FLUSHED);
558 --remaining_play_throughs_; 564 --remaining_play_throughs_;
559 DCHECK_GE(remaining_play_throughs_, 0); 565 DCHECK_GE(remaining_play_throughs_, 0);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 return (size > 0 && !(data[0] & 0x01)); 741 return (size > 0 && !(data[0] & 0x01));
736 } 742 }
737 // Shouldn't happen at this point. 743 // Shouldn't happen at this point.
738 LOG(FATAL) << "Invalid profile: " << profile; 744 LOG(FATAL) << "Invalid profile: " << profile;
739 return false; 745 return false;
740 } 746 }
741 747
742 void GLRenderingVDAClient::DecodeNextFragment() { 748 void GLRenderingVDAClient::DecodeNextFragment() {
743 if (decoder_deleted()) 749 if (decoder_deleted())
744 return; 750 return;
745 if (encoded_data_next_pos_to_decode_ == encoded_data_.size()) { 751 if (encoded_data_next_pos_to_decode_ == encoded_data_.size())
746 if (outstanding_decodes_ == 0) {
747 decoder_->Flush();
748 SetState(CS_FLUSHING);
749 }
750 return; 752 return;
751 } 753
752 size_t end_pos; 754 size_t end_pos;
753 std::string next_fragment_bytes; 755 std::string next_fragment_bytes;
754 if (encoded_data_next_pos_to_decode_ == 0) { 756 if (encoded_data_next_pos_to_decode_ == 0) {
755 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos); 757 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos);
756 } else { 758 } else {
757 next_fragment_bytes = 759 next_fragment_bytes =
758 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos); 760 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos);
759 } 761 }
760 size_t next_fragment_size = next_fragment_bytes.size(); 762 size_t next_fragment_size = next_fragment_bytes.size();
761 763
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 if (it->first == "v" || it->first == "vmodule") 1441 if (it->first == "v" || it->first == "vmodule")
1440 continue; 1442 continue;
1441 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1443 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1442 } 1444 }
1443 1445
1444 base::ShadowingAtExitManager at_exit_manager; 1446 base::ShadowingAtExitManager at_exit_manager;
1445 content::RenderingHelper::InitializeOneOff(); 1447 content::RenderingHelper::InitializeOneOff();
1446 1448
1447 return RUN_ALL_TESTS(); 1449 return RUN_ALL_TESTS();
1448 } 1450 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698