| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/renderer/media/cast_ipc_dispatcher.h" | 5 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "chrome/common/cast_messages.h" | 8 #include "chrome/common/cast_messages.h" |
| 9 #include "chrome/renderer/media/cast_transport_sender_ipc.h" | 9 #include "chrome/renderer/media/cast_transport_sender_ipc.h" |
| 10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool CastIPCDispatcher::OnMessageReceived(const IPC::Message& message) { | 48 bool CastIPCDispatcher::OnMessageReceived(const IPC::Message& message) { |
| 49 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 49 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 50 bool handled = true; | 50 bool handled = true; |
| 51 IPC_BEGIN_MESSAGE_MAP(CastIPCDispatcher, message) | 51 IPC_BEGIN_MESSAGE_MAP(CastIPCDispatcher, message) |
| 52 IPC_MESSAGE_HANDLER(CastMsg_NotifyStatusChange, OnNotifyStatusChange) | 52 IPC_MESSAGE_HANDLER(CastMsg_NotifyStatusChange, OnNotifyStatusChange) |
| 53 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents) | 53 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents) |
| 54 IPC_MESSAGE_HANDLER(CastMsg_Rtt, OnRtt) | 54 IPC_MESSAGE_HANDLER(CastMsg_Rtt, OnRtt) |
| 55 IPC_MESSAGE_HANDLER(CastMsg_RtcpCastMessage, OnRtcpCastMessage) | 55 IPC_MESSAGE_HANDLER(CastMsg_RtcpCastMessage, OnRtcpCastMessage) |
| 56 IPC_MESSAGE_HANDLER(CastMsg_Pli, OnReceivedPli); |
| 56 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket) | 57 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket) |
| 57 IPC_MESSAGE_UNHANDLED(handled = false) | 58 IPC_MESSAGE_UNHANDLED(handled = false) |
| 58 IPC_END_MESSAGE_MAP() | 59 IPC_END_MESSAGE_MAP() |
| 59 return handled; | 60 return handled; |
| 60 } | 61 } |
| 61 | 62 |
| 62 void CastIPCDispatcher::OnFilterAdded(IPC::Sender* sender) { | 63 void CastIPCDispatcher::OnFilterAdded(IPC::Sender* sender) { |
| 63 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 64 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 64 DCHECK(!global_instance_); | 65 DCHECK(!global_instance_); |
| 65 global_instance_ = this; | 66 global_instance_ = this; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 uint32_t ssrc, | 119 uint32_t ssrc, |
| 119 const media::cast::RtcpCastMessage& cast_message) { | 120 const media::cast::RtcpCastMessage& cast_message) { |
| 120 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); | 121 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); |
| 121 if (sender) { | 122 if (sender) { |
| 122 sender->OnRtcpCastMessage(ssrc, cast_message); | 123 sender->OnRtcpCastMessage(ssrc, cast_message); |
| 123 } else { | 124 } else { |
| 124 DVLOG(1) << "CastIPCDispatcher::OnRtt on non-existing channel."; | 125 DVLOG(1) << "CastIPCDispatcher::OnRtt on non-existing channel."; |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 | 128 |
| 129 void CastIPCDispatcher::OnReceivedPli(int32_t channel_id, int32_t ssrc) { |
| 130 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); |
| 131 if (sender) { |
| 132 sender->OnReceivedPli(ssrc); |
| 133 } else { |
| 134 DVLOG(1) << "CastIPCDispatcher::OnReceivedPli on non-existing " |
| 135 "channel."; |
| 136 } |
| 137 } |
| 138 |
| 128 void CastIPCDispatcher::OnReceivedPacket(int32_t channel_id, | 139 void CastIPCDispatcher::OnReceivedPacket(int32_t channel_id, |
| 129 const media::cast::Packet& packet) { | 140 const media::cast::Packet& packet) { |
| 130 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); | 141 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); |
| 131 if (sender) { | 142 if (sender) { |
| 132 sender->OnReceivedPacket(packet); | 143 sender->OnReceivedPacket(packet); |
| 133 } else { | 144 } else { |
| 134 DVLOG(1) << "CastIPCDispatcher::OnReceievdPacket on non-existing channel."; | 145 DVLOG(1) << "CastIPCDispatcher::OnReceievdPacket on non-existing channel."; |
| 135 } | 146 } |
| 136 } | 147 } |
| OLD | NEW |