OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/blink/webmediaplayer_cast_android.h" | 5 #include "media/blink/webmediaplayer_cast_android.h" |
6 | 6 |
7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
9 #include "gpu/command_buffer/common/sync_token.h" | 9 #include "gpu/command_buffer/common/sync_token.h" |
10 #include "media/base/android/media_common_android.h" | 10 #include "media/base/android/media_common_android.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return nullptr; | 117 return nullptr; |
118 GLuint remote_playback_texture_id = 0; | 118 GLuint remote_playback_texture_id = 0; |
119 gl->GenTextures(1, &remote_playback_texture_id); | 119 gl->GenTextures(1, &remote_playback_texture_id); |
120 GLuint texture_target = GL_TEXTURE_2D; | 120 GLuint texture_target = GL_TEXTURE_2D; |
121 gl->BindTexture(texture_target, remote_playback_texture_id); | 121 gl->BindTexture(texture_target, remote_playback_texture_id); |
122 gl->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 122 gl->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
123 gl->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 123 gl->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
124 gl->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 124 gl->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
125 gl->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 125 gl->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
126 | 126 |
127 { | 127 gl->TexImage2D(texture_target, 0 /* level */, GL_RGBA /* internalformat */, |
128 SkAutoLockPixels lock(bitmap); | 128 bitmap.width(), bitmap.height(), 0 /* border */, |
129 gl->TexImage2D(texture_target, 0 /* level */, GL_RGBA /* internalformat */, | 129 GL_RGBA /* format */, GL_UNSIGNED_BYTE /* type */, |
130 bitmap.width(), bitmap.height(), 0 /* border */, | 130 bitmap.getPixels()); |
131 GL_RGBA /* format */, GL_UNSIGNED_BYTE /* type */, | |
132 bitmap.getPixels()); | |
133 } | |
134 | 131 |
135 gpu::Mailbox texture_mailbox; | 132 gpu::Mailbox texture_mailbox; |
136 gl->GenMailboxCHROMIUM(texture_mailbox.name); | 133 gl->GenMailboxCHROMIUM(texture_mailbox.name); |
137 gl->ProduceTextureCHROMIUM(texture_target, texture_mailbox.name); | 134 gl->ProduceTextureCHROMIUM(texture_target, texture_mailbox.name); |
138 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 135 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
139 gl->Flush(); | 136 gl->Flush(); |
140 | 137 |
141 gpu::SyncToken texture_mailbox_sync_token; | 138 gpu::SyncToken texture_mailbox_sync_token; |
142 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, | 139 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, |
143 texture_mailbox_sync_token.GetData()); | 140 texture_mailbox_sync_token.GetData()); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 return MakeTextFrameForCast(remote_playback_message_, canvas_size, | 362 return MakeTextFrameForCast(remote_playback_message_, canvas_size, |
366 webmediaplayer_->NaturalSize(), | 363 webmediaplayer_->NaturalSize(), |
367 base::Bind(&GLCBShim, context_3d_cb_)); | 364 base::Bind(&GLCBShim, context_3d_cb_)); |
368 } | 365 } |
369 | 366 |
370 void WebMediaPlayerCast::setPoster(const blink::WebURL& poster) { | 367 void WebMediaPlayerCast::setPoster(const blink::WebURL& poster) { |
371 player_manager_->SetPoster(player_id_, poster); | 368 player_manager_->SetPoster(player_id_, poster); |
372 } | 369 } |
373 | 370 |
374 } // namespace media | 371 } // namespace media |
OLD | NEW |