OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) | 405 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) |
406 return VideoFrameExternalResources(); | 406 return VideoFrameExternalResources(); |
407 | 407 |
408 if (!context_provider_) | 408 if (!context_provider_) |
409 return VideoFrameExternalResources(); | 409 return VideoFrameExternalResources(); |
410 | 410 |
411 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); | 411 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); |
412 VideoFrameExternalResources external_resources; | 412 VideoFrameExternalResources external_resources; |
413 switch (mailbox_holder->texture_target) { | 413 switch (mailbox_holder->texture_target) { |
414 case GL_TEXTURE_2D: | 414 case GL_TEXTURE_2D: |
415 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; | 415 if (video_frame->has_alpha()) |
| 416 external_resources.type = VideoFrameExternalResources::RGBA_RESOURCE; |
| 417 else |
| 418 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; |
416 break; | 419 break; |
417 case GL_TEXTURE_EXTERNAL_OES: | 420 case GL_TEXTURE_EXTERNAL_OES: |
418 external_resources.type = | 421 external_resources.type = |
419 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; | 422 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; |
420 break; | 423 break; |
421 case GL_TEXTURE_RECTANGLE_ARB: | 424 case GL_TEXTURE_RECTANGLE_ARB: |
422 external_resources.type = VideoFrameExternalResources::IO_SURFACE; | 425 external_resources.type = VideoFrameExternalResources::IO_SURFACE; |
423 break; | 426 break; |
424 default: | 427 default: |
425 NOTREACHED(); | 428 NOTREACHED(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 resource_it->ref_count = 0; | 469 resource_it->ref_count = 0; |
467 updater->DeleteResource(resource_it); | 470 updater->DeleteResource(resource_it); |
468 return; | 471 return; |
469 } | 472 } |
470 | 473 |
471 --resource_it->ref_count; | 474 --resource_it->ref_count; |
472 DCHECK_GE(resource_it->ref_count, 0); | 475 DCHECK_GE(resource_it->ref_count, 0); |
473 } | 476 } |
474 | 477 |
475 } // namespace cc | 478 } // namespace cc |
OLD | NEW |