| 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 "content/common/gpu/media/media_service.h" | 5 #include "media/gpu/ipc/service/media_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | |
| 11 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" | |
| 12 #include "content/common/gpu/media/media_channel.h" | |
| 13 #include "gpu/ipc/service/gpu_channel.h" | 10 #include "gpu/ipc/service/gpu_channel.h" |
| 14 #include "gpu/ipc/service/gpu_channel_manager.h" | 11 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 15 #include "ipc/ipc_message_macros.h" | 12 #include "ipc/ipc_message_macros.h" |
| 16 #include "ipc/param_traits_macros.h" | 13 #include "ipc/param_traits_macros.h" |
| 14 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" |
| 15 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" |
| 16 #include "media/gpu/ipc/service/media_channel.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace media { |
| 19 | 19 |
| 20 MediaService::MediaService(gpu::GpuChannelManager* channel_manager) | 20 MediaService::MediaService(gpu::GpuChannelManager* channel_manager) |
| 21 : channel_manager_(channel_manager) {} | 21 : channel_manager_(channel_manager) {} |
| 22 | 22 |
| 23 MediaService::~MediaService() {} | 23 MediaService::~MediaService() {} |
| 24 | 24 |
| 25 void MediaService::AddChannel(int32_t client_id) { | 25 void MediaService::AddChannel(int32_t client_id) { |
| 26 gpu::GpuChannel* gpu_channel = channel_manager_->LookupChannel(client_id); | 26 gpu::GpuChannel* gpu_channel = channel_manager_->LookupChannel(client_id); |
| 27 DCHECK(gpu_channel); | 27 DCHECK(gpu_channel); |
| 28 std::unique_ptr<MediaChannel> media_channel(new MediaChannel(gpu_channel)); | 28 std::unique_ptr<MediaChannel> media_channel(new MediaChannel(gpu_channel)); |
| 29 gpu_channel->SetUnhandledMessageListener(media_channel.get()); | 29 gpu_channel->SetUnhandledMessageListener(media_channel.get()); |
| 30 media_channels_.set(client_id, std::move(media_channel)); | 30 media_channels_.set(client_id, std::move(media_channel)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void MediaService::RemoveChannel(int32_t client_id) { | 33 void MediaService::RemoveChannel(int32_t client_id) { |
| 34 media_channels_.erase(client_id); | 34 media_channels_.erase(client_id); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void MediaService::DestroyAllChannels() { | 37 void MediaService::DestroyAllChannels() { |
| 38 media_channels_.clear(); | 38 media_channels_.clear(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace content | 41 } // namespace media |
| OLD | NEW |