OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "media/gpu/android_video_decode_accelerator.h" | 5 #include "media/gpu/android_video_decode_accelerator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "gpu/command_buffer/service/mailbox_manager.h" | 27 #include "gpu/command_buffer/service/mailbox_manager.h" |
28 #include "gpu/ipc/service/gpu_channel.h" | 28 #include "gpu/ipc/service/gpu_channel.h" |
29 #include "media/base/android/media_codec_bridge_impl.h" | 29 #include "media/base/android/media_codec_bridge_impl.h" |
30 #include "media/base/android/media_codec_util.h" | 30 #include "media/base/android/media_codec_util.h" |
31 #include "media/base/bind_to_current_loop.h" | 31 #include "media/base/bind_to_current_loop.h" |
32 #include "media/base/bitstream_buffer.h" | 32 #include "media/base/bitstream_buffer.h" |
33 #include "media/base/limits.h" | 33 #include "media/base/limits.h" |
34 #include "media/base/media.h" | 34 #include "media/base/media.h" |
35 #include "media/base/timestamp_constants.h" | 35 #include "media/base/timestamp_constants.h" |
36 #include "media/base/video_decoder_config.h" | 36 #include "media/base/video_decoder_config.h" |
| 37 #include "media/cdm/cdm_manager.h" |
37 #include "media/gpu/android_video_surface_chooser_impl.h" | 38 #include "media/gpu/android_video_surface_chooser_impl.h" |
38 #include "media/gpu/avda_picture_buffer_manager.h" | 39 #include "media/gpu/avda_picture_buffer_manager.h" |
39 #include "media/gpu/content_video_view_overlay.h" | 40 #include "media/gpu/content_video_view_overlay.h" |
40 #include "media/gpu/content_video_view_overlay_factory.h" | 41 #include "media/gpu/content_video_view_overlay_factory.h" |
41 #include "media/gpu/shared_memory_region.h" | 42 #include "media/gpu/shared_memory_region.h" |
42 #include "media/video/picture.h" | 43 #include "media/video/picture.h" |
43 #include "ui/gl/android/scoped_java_surface.h" | 44 #include "ui/gl/android/scoped_java_surface.h" |
44 #include "ui/gl/android/surface_texture.h" | 45 #include "ui/gl/android/surface_texture.h" |
45 #include "ui/gl/gl_bindings.h" | 46 #include "ui/gl/gl_bindings.h" |
46 | 47 |
47 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | |
48 #include "media/mojo/services/mojo_cdm_service.h" // nogncheck | |
49 #endif | |
50 | |
51 #define NOTIFY_ERROR(error_code, error_message) \ | 48 #define NOTIFY_ERROR(error_code, error_message) \ |
52 do { \ | 49 do { \ |
53 DLOG(ERROR) << error_message; \ | 50 DLOG(ERROR) << error_message; \ |
54 NotifyError(VideoDecodeAccelerator::error_code); \ | 51 NotifyError(VideoDecodeAccelerator::error_code); \ |
55 } while (0) | 52 } while (0) |
56 | 53 |
57 namespace media { | 54 namespace media { |
58 | 55 |
59 namespace { | 56 namespace { |
60 | 57 |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 | 1403 |
1407 void AndroidVideoDecodeAccelerator::InitializeCdm() { | 1404 void AndroidVideoDecodeAccelerator::InitializeCdm() { |
1408 DVLOG(2) << __func__ << ": " << config_.cdm_id; | 1405 DVLOG(2) << __func__ << ": " << config_.cdm_id; |
1409 | 1406 |
1410 #if !defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 1407 #if !defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
1411 NOTIMPLEMENTED(); | 1408 NOTIMPLEMENTED(); |
1412 NOTIFY_ERROR(PLATFORM_FAILURE, "Cdm support needs mojo in the gpu process"); | 1409 NOTIFY_ERROR(PLATFORM_FAILURE, "Cdm support needs mojo in the gpu process"); |
1413 #else | 1410 #else |
1414 // Store the CDM to hold a reference to it. | 1411 // Store the CDM to hold a reference to it. |
1415 cdm_for_reference_holding_only_ = | 1412 cdm_for_reference_holding_only_ = |
1416 MojoCdmService::LegacyGetCdm(config_.cdm_id); | 1413 CdmManager::GetInstance()->GetCdm(config_.cdm_id); |
1417 DCHECK(cdm_for_reference_holding_only_); | 1414 DCHECK(cdm_for_reference_holding_only_); |
1418 | 1415 |
1419 // On Android platform the CdmContext must be a MediaDrmBridgeCdmContext. | 1416 // On Android platform the CdmContext must be a MediaDrmBridgeCdmContext. |
1420 media_drm_bridge_cdm_context_ = static_cast<MediaDrmBridgeCdmContext*>( | 1417 media_drm_bridge_cdm_context_ = static_cast<MediaDrmBridgeCdmContext*>( |
1421 cdm_for_reference_holding_only_->GetCdmContext()); | 1418 cdm_for_reference_holding_only_->GetCdmContext()); |
1422 DCHECK(media_drm_bridge_cdm_context_); | 1419 DCHECK(media_drm_bridge_cdm_context_); |
1423 | 1420 |
1424 // Register CDM callbacks. The callbacks registered will be posted back to | 1421 // Register CDM callbacks. The callbacks registered will be posted back to |
1425 // this thread via BindToCurrentLoop. | 1422 // this thread via BindToCurrentLoop. |
1426 | 1423 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 codec_config_->task_type, | 1691 codec_config_->task_type, |
1695 codec_config_->surface_bundle); | 1692 codec_config_->surface_bundle); |
1696 } | 1693 } |
1697 | 1694 |
1698 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { | 1695 void AndroidVideoDecodeAccelerator::ReleaseCodecAndBundle() { |
1699 ReleaseCodec(); | 1696 ReleaseCodec(); |
1700 codec_config_->surface_bundle = nullptr; | 1697 codec_config_->surface_bundle = nullptr; |
1701 } | 1698 } |
1702 | 1699 |
1703 } // namespace media | 1700 } // namespace media |
OLD | NEW |