| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); | 404 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); |
| 405 if (!context_provider_) | 405 if (!context_provider_) |
| 406 return VideoFrameExternalResources(); | 406 return VideoFrameExternalResources(); |
| 407 | 407 |
| 408 size_t textures = | 408 size_t textures = |
| 409 media::VideoFrame::NumTextures(video_frame->texture_format()); | 409 media::VideoFrame::NumTextures(video_frame->texture_format()); |
| 410 DCHECK_GE(textures, 1u); | 410 DCHECK_GE(textures, 1u); |
| 411 VideoFrameExternalResources external_resources; | 411 VideoFrameExternalResources external_resources; |
| 412 switch (video_frame->texture_format()) { | 412 switch (video_frame->texture_format()) { |
| 413 case media::VideoFrame::TEXTURE_RGBA: | 413 case media::VideoFrame::TEXTURE_RGBA: |
| 414 case media::VideoFrame::TEXTURE_RGB: |
| 414 DCHECK_EQ(1u, textures); | 415 DCHECK_EQ(1u, textures); |
| 415 switch (video_frame->mailbox_holder(0).texture_target) { | 416 switch (video_frame->mailbox_holder(0).texture_target) { |
| 416 case GL_TEXTURE_2D: | 417 case GL_TEXTURE_2D: |
| 417 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; | 418 if (video_frame->texture_format() == media::VideoFrame::TEXTURE_RGB) |
| 419 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; |
| 420 else |
| 421 external_resources.type = |
| 422 VideoFrameExternalResources::RGBA_RESOURCE; |
| 418 break; | 423 break; |
| 419 case GL_TEXTURE_EXTERNAL_OES: | 424 case GL_TEXTURE_EXTERNAL_OES: |
| 420 external_resources.type = | 425 external_resources.type = |
| 421 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; | 426 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; |
| 422 break; | 427 break; |
| 423 case GL_TEXTURE_RECTANGLE_ARB: | 428 case GL_TEXTURE_RECTANGLE_ARB: |
| 424 external_resources.type = VideoFrameExternalResources::IO_SURFACE; | 429 external_resources.type = VideoFrameExternalResources::IO_SURFACE; |
| 425 break; | 430 break; |
| 426 default: | 431 default: |
| 427 NOTREACHED(); | 432 NOTREACHED(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 resource_it->ref_count = 0; | 481 resource_it->ref_count = 0; |
| 477 updater->DeleteResource(resource_it); | 482 updater->DeleteResource(resource_it); |
| 478 return; | 483 return; |
| 479 } | 484 } |
| 480 | 485 |
| 481 --resource_it->ref_count; | 486 --resource_it->ref_count; |
| 482 DCHECK_GE(resource_it->ref_count, 0); | 487 DCHECK_GE(resource_it->ref_count, 0); |
| 483 } | 488 } |
| 484 | 489 |
| 485 } // namespace cc | 490 } // namespace cc |
| OLD | NEW |