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 "chrome/common/cast_messages.h" | 7 #include "chrome/common/cast_messages.h" |
8 #include "chrome/renderer/media/cast_transport_sender_ipc.h" | 8 #include "chrome/renderer/media/cast_transport_sender_ipc.h" |
9 #include "ipc/ipc_message_macros.h" | 9 #include "ipc/ipc_message_macros.h" |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void CastIPCDispatcher::RemoveSender(int32 channel_id) { | 43 void CastIPCDispatcher::RemoveSender(int32 channel_id) { |
44 return id_map_.Remove(channel_id); | 44 return id_map_.Remove(channel_id); |
45 } | 45 } |
46 | 46 |
47 bool CastIPCDispatcher::OnMessageReceived(const IPC::Message& message) { | 47 bool CastIPCDispatcher::OnMessageReceived(const IPC::Message& message) { |
48 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 48 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
49 bool handled = true; | 49 bool handled = true; |
50 IPC_BEGIN_MESSAGE_MAP(CastIPCDispatcher, message) | 50 IPC_BEGIN_MESSAGE_MAP(CastIPCDispatcher, message) |
51 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket) | 51 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket) |
52 IPC_MESSAGE_HANDLER(CastMsg_NotifyStatusChange, OnNotifyStatusChange) | 52 IPC_MESSAGE_HANDLER(CastMsg_NotifyStatusChange, OnNotifyStatusChange) |
53 IPC_MESSAGE_HANDLER(CastMsg_RtpStatistics, OnRtpStatistics) | |
54 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents) | 53 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents) |
55 IPC_MESSAGE_UNHANDLED(handled = false); | 54 IPC_MESSAGE_UNHANDLED(handled = false); |
56 IPC_END_MESSAGE_MAP(); | 55 IPC_END_MESSAGE_MAP(); |
57 return handled; | 56 return handled; |
58 } | 57 } |
59 | 58 |
60 void CastIPCDispatcher::OnFilterAdded(IPC::Channel* channel) { | 59 void CastIPCDispatcher::OnFilterAdded(IPC::Channel* channel) { |
61 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 60 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
62 DCHECK(!global_instance_); | 61 DCHECK(!global_instance_); |
63 global_instance_ = this; | 62 global_instance_ = this; |
(...skipping 29 matching lines...) Expand all Loading... |
93 media::cast::transport::CastTransportStatus status) { | 92 media::cast::transport::CastTransportStatus status) { |
94 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); | 93 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); |
95 if (sender) { | 94 if (sender) { |
96 sender->OnNotifyStatusChange(status); | 95 sender->OnNotifyStatusChange(status); |
97 } else { | 96 } else { |
98 DVLOG(1) | 97 DVLOG(1) |
99 << "CastIPCDispatcher::OnNotifystatusChange on non-existing channel."; | 98 << "CastIPCDispatcher::OnNotifystatusChange on non-existing channel."; |
100 } | 99 } |
101 } | 100 } |
102 | 101 |
103 void CastIPCDispatcher::OnRtpStatistics( | |
104 int32 channel_id, | |
105 bool audio, | |
106 const media::cast::transport::RtcpSenderInfo& sender_info, | |
107 base::TimeTicks time_sent, | |
108 uint32 rtp_timestamp) { | |
109 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); | |
110 if (sender) { | |
111 sender->OnRtpStatistics(audio, sender_info, time_sent, rtp_timestamp); | |
112 } else { | |
113 DVLOG(1) << "CastIPCDispatcher::OnRtpStatistics on non-existing channel."; | |
114 } | |
115 } | |
116 | |
117 void CastIPCDispatcher::OnRawEvents( | 102 void CastIPCDispatcher::OnRawEvents( |
118 int32 channel_id, | 103 int32 channel_id, |
119 const std::vector<media::cast::PacketEvent>& packet_events) { | 104 const std::vector<media::cast::PacketEvent>& packet_events) { |
120 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); | 105 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); |
121 if (sender) { | 106 if (sender) { |
122 sender->OnRawEvents(packet_events); | 107 sender->OnRawEvents(packet_events); |
123 } else { | 108 } else { |
124 DVLOG(1) << "CastIPCDispatcher::OnRawEvents on non-existing channel."; | 109 DVLOG(1) << "CastIPCDispatcher::OnRawEvents on non-existing channel."; |
125 } | 110 } |
126 } | 111 } |
OLD | NEW |