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

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: address review comments. 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 if (outstanding_decodes_ == 0) {
Pawel Osciak 2015/09/04 08:15:30 Please add a TODO explaining we should not have to
Owen Lin 2015/09/07 03:54:18 Done.
736 decoder_->Flush();
737 SetState(CS_FLUSHING);
738 }
739 } else if (decode_calls_per_second_ == 0) {
733 DecodeNextFragment(); 740 DecodeNextFragment();
741 }
734 } 742 }
735 743
736 void GLRenderingVDAClient::NotifyFlushDone() { 744 void GLRenderingVDAClient::NotifyFlushDone() {
737 if (decoder_deleted()) 745 if (decoder_deleted())
738 return; 746 return;
739 747
740 SetState(CS_FLUSHED); 748 SetState(CS_FLUSHED);
741 --remaining_play_throughs_; 749 --remaining_play_throughs_;
742 DCHECK_GE(remaining_play_throughs_, 0); 750 DCHECK_GE(remaining_play_throughs_, 0);
743 if (decoder_deleted()) 751 if (decoder_deleted())
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 return (size > 0 && !(data[0] & 0x01)); 923 return (size > 0 && !(data[0] & 0x01));
916 } 924 }
917 // Shouldn't happen at this point. 925 // Shouldn't happen at this point.
918 LOG(FATAL) << "Invalid profile: " << profile; 926 LOG(FATAL) << "Invalid profile: " << profile;
919 return false; 927 return false;
920 } 928 }
921 929
922 void GLRenderingVDAClient::DecodeNextFragment() { 930 void GLRenderingVDAClient::DecodeNextFragment() {
923 if (decoder_deleted()) 931 if (decoder_deleted())
924 return; 932 return;
925 if (encoded_data_next_pos_to_decode_ == encoded_data_.size()) { 933 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; 934 return;
931 }
932 size_t end_pos; 935 size_t end_pos;
933 std::string next_fragment_bytes; 936 std::string next_fragment_bytes;
934 if (encoded_data_next_pos_to_decode_ == 0) { 937 if (encoded_data_next_pos_to_decode_ == 0) {
935 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos); 938 next_fragment_bytes = GetBytesForFirstFragment(0, &end_pos);
936 } else { 939 } else {
937 next_fragment_bytes = 940 next_fragment_bytes =
938 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos); 941 GetBytesForNextFragment(encoded_data_next_pos_to_decode_, &end_pos);
939 } 942 }
940 size_t next_fragment_size = next_fragment_bytes.size(); 943 size_t next_fragment_size = next_fragment_bytes.size();
941 944
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 content::VaapiWrapper::PreSandboxInitialization(); 1652 content::VaapiWrapper::PreSandboxInitialization();
1650 #endif 1653 #endif
1651 1654
1652 content::g_env = 1655 content::g_env =
1653 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1656 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1654 testing::AddGlobalTestEnvironment( 1657 testing::AddGlobalTestEnvironment(
1655 new content::VideoDecodeAcceleratorTestEnvironment())); 1658 new content::VideoDecodeAcceleratorTestEnvironment()));
1656 1659
1657 return RUN_ALL_TESTS(); 1660 return RUN_ALL_TESTS();
1658 } 1661 }
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