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

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

Issue 1682343002: AVDACodecImages keep a reference to the SurfaceTexture backing them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/avda_shared_state.h" 5 #include "content/common/gpu/media/avda_shared_state.h"
6 6
7 #include "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/scoped_make_current.h" 8 #include "ui/gl/scoped_make_current.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 AVDASharedState::AVDASharedState() 12 AVDASharedState::AVDASharedState()
13 : surface_texture_service_id_(0), 13 : surface_texture_service_id_(0),
14 frame_available_event_(false, false), 14 frame_available_event_(false, false),
15 surface_texture_is_attached_(false) {} 15 surface_texture_is_attached_(false) {}
16 16
17 AVDASharedState::~AVDASharedState() {} 17 AVDASharedState::~AVDASharedState() {
liberato (no reviews please) 2016/02/10 21:05:15 i think that you have to maintain a list of Textur
watk 2016/02/11 00:26:51 Discussed offline that this is not necessary becau
18 if (surface_texture_service_id_ != 0 && context_) {
liberato (no reviews please) 2016/02/10 21:05:15 it might be worthwhile to pass in the avda's conte
19 // XXX: This is the wrong context.
liberato (no reviews please) 2016/02/10 06:39:12 it's worth a comment that it's a different one tha
watk 2016/02/11 00:26:51 Ah, that's why everything works, thanks.
20 auto scoped_make_current = make_scoped_ptr(
21 new ui::ScopedMakeCurrent(context_.get(), surface_.get()));
22 glDeleteTextures(1, &surface_texture_service_id_);
23 }
24 }
18 25
19 void AVDASharedState::SignalFrameAvailable() { 26 void AVDASharedState::SignalFrameAvailable() {
20 frame_available_event_.Signal(); 27 frame_available_event_.Signal();
21 } 28 }
22 29
23 void AVDASharedState::WaitForFrameAvailable() { 30 void AVDASharedState::WaitForFrameAvailable() {
24 frame_available_event_.Wait(); 31 frame_available_event_.Wait();
25 } 32 }
26 33
27 void AVDASharedState::did_attach_surface_texture() { 34 void AVDASharedState::DidAttachSurfaceTexture() {
28 context_ = gfx::GLContext::GetCurrent(); 35 context_ = gfx::GLContext::GetCurrent();
29 surface_ = gfx::GLSurface::GetCurrent(); 36 surface_ = gfx::GLSurface::GetCurrent();
30 DCHECK(context_); 37 DCHECK(context_);
31 DCHECK(surface_); 38 DCHECK(surface_);
32 39
33 surface_texture_is_attached_ = true; 40 surface_texture_is_attached_ = true;
34 } 41 }
35 42
36 } // namespace content 43 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698