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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) | 53 IPC_MESSAGE_HANDLER(CastMsg_RtpStatistics, OnRtpStatistics) |
54 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents) | |
54 IPC_MESSAGE_UNHANDLED(handled = false); | 55 IPC_MESSAGE_UNHANDLED(handled = false); |
55 IPC_END_MESSAGE_MAP(); | 56 IPC_END_MESSAGE_MAP(); |
56 return handled; | 57 return handled; |
57 } | 58 } |
58 | 59 |
59 void CastIPCDispatcher::OnFilterAdded(IPC::Channel* channel) { | 60 void CastIPCDispatcher::OnFilterAdded(IPC::Channel* channel) { |
60 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 61 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
61 DCHECK(!global_instance_); | 62 DCHECK(!global_instance_); |
62 global_instance_ = this; | 63 global_instance_ = this; |
63 channel_ = channel; | 64 channel_ = channel; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 void CastIPCDispatcher::OnRtpStatistics( | 103 void CastIPCDispatcher::OnRtpStatistics( |
103 int32 channel_id, | 104 int32 channel_id, |
104 bool audio, | 105 bool audio, |
105 const media::cast::transport::RtcpSenderInfo& sender_info, | 106 const media::cast::transport::RtcpSenderInfo& sender_info, |
106 base::TimeTicks time_sent, | 107 base::TimeTicks time_sent, |
107 uint32 rtp_timestamp) { | 108 uint32 rtp_timestamp) { |
108 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); | 109 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); |
109 if (sender) { | 110 if (sender) { |
110 sender->OnRtpStatistics(audio, sender_info, time_sent, rtp_timestamp); | 111 sender->OnRtpStatistics(audio, sender_info, time_sent, rtp_timestamp); |
111 } else { | 112 } else { |
112 LOG(ERROR) | 113 LOG(ERROR) << "CastIPCDispatcher::OnRtpStatistics on non-existing channel."; |
113 << "CastIPCDispatcher::OnNotifystatusChange on non-existing channel."; | |
114 } | 114 } |
115 } | 115 } |
116 | |
117 void CastIPCDispatcher::OnRawEvents( | |
118 int32 channel_id, | |
119 const std::vector<media::cast::PacketEvent>& packet_events) { | |
120 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); | |
121 if (sender) { | |
122 sender->OnRawEvents(packet_events); | |
123 } else { | |
124 LOG(ERROR) << "CastIPCDispatcher::OnRawEvents on non-existing channel."; | |
miu
2014/02/26 22:43:51
This, and the other LOG(ERROR) statements in this
imcheng
2014/02/26 23:35:55
Is it an error? It looks like the CastTransportSen
miu
2014/02/26 23:57:52
SGTM. Can you fix the others too, please?
| |
125 } | |
126 } | |
OLD | NEW |