| 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/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (!frame_available_event_.TimedWait(remaining)) { | 47 if (!frame_available_event_.TimedWait(remaining)) { |
| 48 DVLOG(1) << "WaitForFrameAvailable() timed out, elapsed: " | 48 DVLOG(1) << "WaitForFrameAvailable() timed out, elapsed: " |
| 49 << elapsed.InMillisecondsF() | 49 << elapsed.InMillisecondsF() |
| 50 << "ms, additionally waited: " << remaining.InMillisecondsF() | 50 << "ms, additionally waited: " << remaining.InMillisecondsF() |
| 51 << "ms, total: " << (elapsed + remaining).InMillisecondsF() | 51 << "ms, total: " << (elapsed + remaining).InMillisecondsF() |
| 52 << "ms"; | 52 << "ms"; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 void AVDASharedState::DidAttachSurfaceTexture() { | 56 void AVDASharedState::DidAttachSurfaceTexture() { |
| 57 context_ = gfx::GLContext::GetCurrent(); | 57 context_ = gl::GLContext::GetCurrent(); |
| 58 surface_ = gfx::GLSurface::GetCurrent(); | 58 surface_ = gl::GLSurface::GetCurrent(); |
| 59 DCHECK(context_); | 59 DCHECK(context_); |
| 60 DCHECK(surface_); | 60 DCHECK(surface_); |
| 61 | 61 |
| 62 surface_texture_is_attached_ = true; | 62 surface_texture_is_attached_ = true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void AVDASharedState::CodecChanged(media::MediaCodecBridge* codec) { | 65 void AVDASharedState::CodecChanged(media::MediaCodecBridge* codec) { |
| 66 for (auto& image_kv : codec_images_) | 66 for (auto& image_kv : codec_images_) |
| 67 image_kv.second->CodecChanged(codec); | 67 image_kv.second->CodecChanged(codec); |
| 68 release_time_ = base::TimeTicks(); | 68 release_time_ = base::TimeTicks(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 89 void AVDASharedState::RenderCodecBufferToSurfaceTexture( | 89 void AVDASharedState::RenderCodecBufferToSurfaceTexture( |
| 90 media::MediaCodecBridge* codec, | 90 media::MediaCodecBridge* codec, |
| 91 int codec_buffer_index) { | 91 int codec_buffer_index) { |
| 92 if (!release_time_.is_null()) | 92 if (!release_time_.is_null()) |
| 93 WaitForFrameAvailable(); | 93 WaitForFrameAvailable(); |
| 94 codec->ReleaseOutputBuffer(codec_buffer_index, true); | 94 codec->ReleaseOutputBuffer(codec_buffer_index, true); |
| 95 release_time_ = base::TimeTicks::Now(); | 95 release_time_ = base::TimeTicks::Now(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace media | 98 } // namespace media |
| OLD | NEW |