| OLD | NEW |
| 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 "media/gpu/avda_shared_state.h" | 5 #include "media/gpu/avda_shared_state.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "media/gpu/avda_codec_image.h" | 9 #include "media/gpu/avda_codec_image.h" |
| 10 #include "ui/gl/android/surface_texture.h" | 10 #include "ui/gl/android/surface_texture.h" |
| 11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
| 12 #include "ui/gl/scoped_make_current.h" | 12 #include "ui/gl/scoped_make_current.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 AVDASharedState::AVDASharedState() | 16 AVDASharedState::AVDASharedState() |
| 17 : surface_texture_service_id_(0), frame_available_event_(false, false) {} | 17 : surface_texture_service_id_(0), |
| 18 frame_available_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 19 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 18 | 20 |
| 19 AVDASharedState::~AVDASharedState() { | 21 AVDASharedState::~AVDASharedState() { |
| 20 if (!surface_texture_service_id_) | 22 if (!surface_texture_service_id_) |
| 21 return; | 23 return; |
| 22 | 24 |
| 23 ui::ScopedMakeCurrent scoped_make_current(context_.get(), surface_.get()); | 25 ui::ScopedMakeCurrent scoped_make_current(context_.get(), surface_.get()); |
| 24 if (scoped_make_current.Succeeded()) { | 26 if (scoped_make_current.Succeeded()) { |
| 25 glDeleteTextures(1, &surface_texture_service_id_); | 27 glDeleteTextures(1, &surface_texture_service_id_); |
| 26 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 28 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 27 } | 29 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void AVDASharedState::RenderCodecBufferToSurfaceTexture( | 101 void AVDASharedState::RenderCodecBufferToSurfaceTexture( |
| 100 media::MediaCodecBridge* codec, | 102 media::MediaCodecBridge* codec, |
| 101 int codec_buffer_index) { | 103 int codec_buffer_index) { |
| 102 if (!release_time_.is_null()) | 104 if (!release_time_.is_null()) |
| 103 WaitForFrameAvailable(); | 105 WaitForFrameAvailable(); |
| 104 codec->ReleaseOutputBuffer(codec_buffer_index, true); | 106 codec->ReleaseOutputBuffer(codec_buffer_index, true); |
| 105 release_time_ = base::TimeTicks::Now(); | 107 release_time_ = base::TimeTicks::Now(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 } // namespace media | 110 } // namespace media |
| OLD | NEW |