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

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: Add TODO for Pawel's comment. 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 // TODO(owenlin): We should not have to check the number of
736 // |outstanding_decodes_|. |decoder_| should be able to accept Flush()
737 // before it's done with outstanding decodes. (crbug.com/528183)
738 if (outstanding_decodes_ == 0) {
739 decoder_->Flush();
740 SetState(CS_FLUSHING);
741 }
742 } else if (decode_calls_per_second_ == 0) {
733 DecodeNextFragment(); 743 DecodeNextFragment();
744 }
734 } 745 }
735 746
736 void GLRenderingVDAClient::NotifyFlushDone() { 747 void GLRenderingVDAClient::NotifyFlushDone() {
737 if (decoder_deleted()) 748 if (decoder_deleted())
738 return; 749 return;
739 750
740 SetState(CS_FLUSHED); 751 SetState(CS_FLUSHED);
741 --remaining_play_throughs_; 752 --remaining_play_throughs_;
742 DCHECK_GE(remaining_play_throughs_, 0); 753 DCHECK_GE(remaining_play_throughs_, 0);
743 if (decoder_deleted()) 754 if (decoder_deleted())
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 return (size > 0 && !(data[0] & 0x01)); 926 return (size > 0 && !(data[0] & 0x01));
916 } 927 }
917 // Shouldn't happen at this point. 928 // Shouldn't happen at this point.
918 LOG(FATAL) << "Invalid profile: " << profile; 929 LOG(FATAL) << "Invalid profile: " << profile;
919 return false; 930 return false;
920 } 931 }
921 932
922 void GLRenderingVDAClient::DecodeNextFragment() { 933 void GLRenderingVDAClient::DecodeNextFragment() {
923 if (decoder_deleted()) 934 if (decoder_deleted())
924 return; 935 return;
925 if (encoded_data_next_pos_to_decode_ == encoded_data_.size()) { 936 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; 937 return;
931 }
932 size_t end_pos; 938 size_t end_pos;
933 std::string next_fragment_bytes; 939 std::string next_fragment_bytes;
934 if (encoded_data_next_pos_to_decode_ == 0) { 940 if (encoded_data_next_pos_to_decode_ == 0) {
935 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos); 941 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos);
936 } else { 942 } else {
937 next_fragment_bytes = 943 next_fragment_bytes =
938 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos); 944 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos);
939 } 945 }
940 size_t next_fragment_size = next_fragment_bytes.size(); 946 size_t next_fragment_size = next_fragment_bytes.size();
941 947
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 content::VaapiWrapper::PreSandboxInitialization(); 1655 content::VaapiWrapper::PreSandboxInitialization();
1650 #endif 1656 #endif
1651 1657
1652 content::g_env = 1658 content::g_env =
1653 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1659 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1654 testing::AddGlobalTestEnvironment( 1660 testing::AddGlobalTestEnvironment(
1655 new content::VideoDecodeAcceleratorTestEnvironment())); 1661 new content::VideoDecodeAcceleratorTestEnvironment()));
1656 1662
1657 return RUN_ALL_TESTS(); 1663 return RUN_ALL_TESTS();
1658 } 1664 }
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