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

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

Issue 10826238: Ensure that the correct open gl context is made current before attempting to write to the open (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" 5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
6 6
7 #if !defined(OS_WIN) 7 #if !defined(OS_WIN)
8 #error This file should only be built on Windows. 8 #error This file should only be built on Windows.
9 #endif // !defined(OS_WIN) 9 #endif // !defined(OS_WIN)
10 10
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device query", false); 492 RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device query", false);
493 // Ensure query_ API works (to avoid an infinite loop later in 493 // Ensure query_ API works (to avoid an infinite loop later in
494 // CopyOutputSampleDataToPictureBuffer). 494 // CopyOutputSampleDataToPictureBuffer).
495 hr = query_->Issue(D3DISSUE_END); 495 hr = query_->Issue(D3DISSUE_END);
496 RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false); 496 RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false);
497 497
498 return true; 498 return true;
499 } 499 }
500 500
501 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( 501 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
502 media::VideoDecodeAccelerator::Client* client) 502 media::VideoDecodeAccelerator::Client* client,
503 const base::Callback<bool(void)>& make_context_current)
503 : client_(client), 504 : client_(client),
504 egl_config_(NULL), 505 egl_config_(NULL),
505 state_(kUninitialized), 506 state_(kUninitialized),
506 pictures_requested_(false), 507 pictures_requested_(false),
507 inputs_before_decode_(0) { 508 inputs_before_decode_(0),
509 make_context_current_(make_context_current) {
508 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); 510 memset(&input_stream_info_, 0, sizeof(input_stream_info_));
509 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); 511 memset(&output_stream_info_, 0, sizeof(output_stream_info_));
510 } 512 }
511 513
512 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { 514 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() {
513 client_ = NULL; 515 client_ = NULL;
514 } 516 }
515 517
516 bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile) { 518 bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile) {
517 DCHECK(CalledOnValidThread()); 519 DCHECK(CalledOnValidThread());
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 base::AsWeakPtr(this), surface_desc.Width, surface_desc.Height)); 960 base::AsWeakPtr(this), surface_desc.Width, surface_desc.Height));
959 961
960 pictures_requested_ = true; 962 pictures_requested_ = true;
961 return true; 963 return true;
962 } 964 }
963 965
964 void DXVAVideoDecodeAccelerator::ProcessPendingSamples() { 966 void DXVAVideoDecodeAccelerator::ProcessPendingSamples() {
965 if (pending_output_samples_.empty()) 967 if (pending_output_samples_.empty())
966 return; 968 return;
967 969
970 if (!make_context_current_.Run()) {
971 StopOnError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
972 return;
973 }
974
968 OutputBuffers::iterator index; 975 OutputBuffers::iterator index;
969 976
970 for (index = output_picture_buffers_.begin(); 977 for (index = output_picture_buffers_.begin();
971 index != output_picture_buffers_.end() && 978 index != output_picture_buffers_.end() &&
972 !pending_output_samples_.empty(); 979 !pending_output_samples_.empty();
973 ++index) { 980 ++index) {
974 if (index->second->available()) { 981 if (index->second->available()) {
975 PendingSampleInfo sample_info = pending_output_samples_.front(); 982 PendingSampleInfo sample_info = pending_output_samples_.front();
976 983
977 RETURN_AND_NOTIFY_ON_FAILURE( 984 RETURN_AND_NOTIFY_ON_FAILURE(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 GL_TEXTURE_2D); 1056 GL_TEXTURE_2D);
1050 } 1057 }
1051 } 1058 }
1052 1059
1053 void DXVAVideoDecodeAccelerator::NotifyPictureReady( 1060 void DXVAVideoDecodeAccelerator::NotifyPictureReady(
1054 const media::Picture& picture) { 1061 const media::Picture& picture) {
1055 // This task could execute after the decoder has been torn down. 1062 // This task could execute after the decoder has been torn down.
1056 if (state_ != kUninitialized && client_) 1063 if (state_ != kUninitialized && client_)
1057 client_->PictureReady(picture); 1064 client_->PictureReady(picture);
1058 } 1065 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/dxva_video_decode_accelerator.h ('k') | content/common/gpu/media/gpu_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698