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

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

Issue 1321423004: vda_unittest: Fix Flush() is not called when decoding is slow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 722 }
723 723
724 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer( 724 void GLRenderingVDAClient::NotifyEndOfBitstreamBuffer(
725 int32 bitstream_buffer_id) { 725 int32 bitstream_buffer_id) {
726 // TODO(fischman): this test currently relies on this notification to make 726 // TODO(fischman): this test currently relies on this notification to make
727 // forward progress during a Reset(). But the VDA::Reset() API doesn't 727 // forward progress during a Reset(). But the VDA::Reset() API doesn't
728 // guarantee this, so stop relying on it (and remove the notifications from 728 // guarantee this, so stop relying on it (and remove the notifications from
729 // VaapiVideoDecodeAccelerator::FinishReset()). 729 // VaapiVideoDecodeAccelerator::FinishReset()).
730 ++num_done_bitstream_buffers_; 730 ++num_done_bitstream_buffers_;
731 --outstanding_decodes_; 731 --outstanding_decodes_;
732 if (decode_calls_per_second_ == 0) 732
733 // Flush decoder after all BitstreamBuffers are processed.
734 if (encoded_data_next_pos_to_decode_ == encoded_data_.size() &&
735 outstanding_decodes_ == 0) {
wuchengli 2015/09/04 03:26:06 No need to call DecodeNextFragment if reaching the
Pawel Osciak 2015/09/04 06:04:40 Do we need to check outstanding_decodes_? I think
Owen Lin 2015/09/04 07:15:43 Done.
Owen Lin 2015/09/04 07:15:44 This is what I thought. (So I issue the Flush once
736 decoder_->Flush();
737 SetState(CS_FLUSHING);
738 } else if (decode_calls_per_second_ == 0) {
733 DecodeNextFragment(); 739 DecodeNextFragment();
740 }
734 } 741 }
735 742
736 void GLRenderingVDAClient::NotifyFlushDone() { 743 void GLRenderingVDAClient::NotifyFlushDone() {
737 if (decoder_deleted()) 744 if (decoder_deleted())
738 return; 745 return;
739 746
740 SetState(CS_FLUSHED); 747 SetState(CS_FLUSHED);
741 --remaining_play_throughs_; 748 --remaining_play_throughs_;
742 DCHECK_GE(remaining_play_throughs_, 0); 749 DCHECK_GE(remaining_play_throughs_, 0);
743 if (decoder_deleted()) 750 if (decoder_deleted())
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 return (size > 0 && !(data[0] & 0x01)); 922 return (size > 0 && !(data[0] & 0x01));
916 } 923 }
917 // Shouldn't happen at this point. 924 // Shouldn't happen at this point.
918 LOG(FATAL) << "Invalid profile: " << profile; 925 LOG(FATAL) << "Invalid profile: " << profile;
919 return false; 926 return false;
920 } 927 }
921 928
922 void GLRenderingVDAClient::DecodeNextFragment() { 929 void GLRenderingVDAClient::DecodeNextFragment() {
923 if (decoder_deleted()) 930 if (decoder_deleted())
924 return; 931 return;
925 if (encoded_data_next_pos_to_decode_ == encoded_data_.size()) { 932 if (encoded_data_next_pos_to_decode_ == encoded_data_.size())
926 if (outstanding_decodes_ == 0) {
927 decoder_->Flush();
928 SetState(CS_FLUSHING);
929 }
930 return; 933 return;
931 }
932 size_t end_pos; 934 size_t end_pos;
933 std::string next_fragment_bytes; 935 std::string next_fragment_bytes;
934 if (encoded_data_next_pos_to_decode_ == 0) { 936 if (encoded_data_next_pos_to_decode_ == 0) {
935 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos); 937 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos);
936 } else { 938 } else {
937 next_fragment_bytes = 939 next_fragment_bytes =
938 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos); 940 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos);
939 } 941 }
940 size_t next_fragment_size = next_fragment_bytes.size(); 942 size_t next_fragment_size = next_fragment_bytes.size();
941 943
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 content::VaapiWrapper::PreSandboxInitialization(); 1651 content::VaapiWrapper::PreSandboxInitialization();
1650 #endif 1652 #endif
1651 1653
1652 content::g_env = 1654 content::g_env =
1653 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1655 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1654 testing::AddGlobalTestEnvironment( 1656 testing::AddGlobalTestEnvironment(
1655 new content::VideoDecodeAcceleratorTestEnvironment())); 1657 new content::VideoDecodeAcceleratorTestEnvironment()));
1656 1658
1657 return RUN_ALL_TESTS(); 1659 return RUN_ALL_TESTS();
1658 } 1660 }
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