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

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

Issue 10827074: Replace the explicit *VDA::Set{CGL,Egl,Glx}Context() methods with ctor params. (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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 DVLOG(1) << "Notifying of error " << error; 45 DVLOG(1) << "Notifying of error " << error;
46 46
47 if (client_) { 47 if (client_) {
48 client_->NotifyError(error); 48 client_->NotifyError(error);
49 client_ptr_factory_.InvalidateWeakPtrs(); 49 client_ptr_factory_.InvalidateWeakPtrs();
50 } 50 }
51 Cleanup(); 51 Cleanup();
52 } 52 }
53 53
54 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( 54 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator(
55 Display* x_display, GLXContext glx_context,
55 Client* client, 56 Client* client,
56 const base::Callback<bool(void)>& make_context_current) 57 const base::Callback<bool(void)>& make_context_current)
57 : make_context_current_(make_context_current), 58 : x_display_(x_display),
59 glx_context_(glx_context),
60 make_context_current_(make_context_current),
58 state_(kUninitialized), 61 state_(kUninitialized),
59 input_ready_(&lock_), 62 input_ready_(&lock_),
60 output_ready_(&lock_), 63 output_ready_(&lock_),
61 message_loop_(MessageLoop::current()), 64 message_loop_(MessageLoop::current()),
62 weak_this_(base::AsWeakPtr(this)), 65 weak_this_(base::AsWeakPtr(this)),
63 client_ptr_factory_(client), 66 client_ptr_factory_(client),
64 client_(client_ptr_factory_.GetWeakPtr()), 67 client_(client_ptr_factory_.GetWeakPtr()),
65 decoder_thread_("VaapiDecoderThread") { 68 decoder_thread_("VaapiDecoderThread") {
66 DCHECK(client); 69 DCHECK(client);
67 } 70 }
(...skipping 21 matching lines...) Expand all
89 92
90 CHECK(decoder_thread_.Start()); 93 CHECK(decoder_thread_.Start());
91 94
92 state_ = kInitialized; 95 state_ = kInitialized;
93 96
94 message_loop_->PostTask(FROM_HERE, base::Bind( 97 message_loop_->PostTask(FROM_HERE, base::Bind(
95 &Client::NotifyInitializeDone, client_)); 98 &Client::NotifyInitializeDone, client_));
96 return true; 99 return true;
97 } 100 }
98 101
99 // TODO(posciak, fischman): try to move these to constructor parameters,
100 // but while removing SetEglState from OVDA as well for symmetry.
101 void VaapiVideoDecodeAccelerator::SetGlxState(Display* x_display,
102 GLXContext glx_context) {
103 DCHECK_EQ(message_loop_, MessageLoop::current());
104 x_display_ = x_display;
105 glx_context_ = glx_context;
106 }
107
108 void VaapiVideoDecodeAccelerator::SyncAndNotifyPictureReady(int32 input_id, 102 void VaapiVideoDecodeAccelerator::SyncAndNotifyPictureReady(int32 input_id,
109 int32 output_id) { 103 int32 output_id) {
110 DCHECK_EQ(message_loop_, MessageLoop::current()); 104 DCHECK_EQ(message_loop_, MessageLoop::current());
111 // Handle Destroy() arriving while pictures are queued for output. 105 // Handle Destroy() arriving while pictures are queued for output.
112 if (!client_) 106 if (!client_)
113 return; 107 return;
114 108
115 // Sync the contents of the texture. 109 // Sync the contents of the texture.
116 RETURN_AND_NOTIFY_ON_FAILURE(decoder_.PutPicToTexture(output_id), 110 RETURN_AND_NOTIFY_ON_FAILURE(decoder_.PutPicToTexture(output_id),
117 "Failed putting picture to texture", 111 "Failed putting picture to texture",
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 "Input id", input_id, "Picture id", output_id); 543 "Input id", input_id, "Picture id", output_id);
550 DVLOG(4) << "Outputting picture, input id: " << input_id 544 DVLOG(4) << "Outputting picture, input id: " << input_id
551 << " output id: " << output_id; 545 << " output id: " << output_id;
552 546
553 // Forward the request to the main thread. 547 // Forward the request to the main thread.
554 DCHECK_EQ(decoder_thread_.message_loop(), MessageLoop::current()); 548 DCHECK_EQ(decoder_thread_.message_loop(), MessageLoop::current());
555 message_loop_->PostTask(FROM_HERE, base::Bind( 549 message_loop_->PostTask(FROM_HERE, base::Bind(
556 &VaapiVideoDecodeAccelerator::SyncAndNotifyPictureReady, weak_this_, 550 &VaapiVideoDecodeAccelerator::SyncAndNotifyPictureReady, weak_this_,
557 input_id, output_id)); 551 input_id, output_id));
558 } 552 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698