| 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_transport_sender_ipc.h" | 5 #include "chrome/renderer/media/cast_transport_sender_ipc.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "chrome/common/cast_messages.h" | 9 #include "chrome/common/cast_messages.h" |
| 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" | 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 media::cast::CastTransportStatus status) { | 83 media::cast::CastTransportStatus status) { |
| 84 status_callback_.Run(status); | 84 status_callback_.Run(status); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void CastTransportSenderIPC::OnRawEvents( | 87 void CastTransportSenderIPC::OnRawEvents( |
| 88 const std::vector<media::cast::PacketEvent>& packet_events, | 88 const std::vector<media::cast::PacketEvent>& packet_events, |
| 89 const std::vector<media::cast::FrameEvent>& frame_events) { | 89 const std::vector<media::cast::FrameEvent>& frame_events) { |
| 90 raw_events_callback_.Run(packet_events, frame_events); | 90 raw_events_callback_.Run(packet_events, frame_events); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void CastTransportSenderIPC::OnRtt( | 93 void CastTransportSenderIPC::OnRtt(uint32 ssrc, base::TimeDelta rtt) { |
| 94 uint32 ssrc, | |
| 95 const media::cast::RtcpRttReport& rtt_report) { | |
| 96 ClientMap::iterator it = clients_.find(ssrc); | 94 ClientMap::iterator it = clients_.find(ssrc); |
| 97 if (it == clients_.end()) { | 95 if (it == clients_.end()) { |
| 98 LOG(ERROR) << "Received RTT report from for unknown SSRC: " << ssrc; | 96 LOG(ERROR) << "Received RTT report from for unknown SSRC: " << ssrc; |
| 99 return; | 97 return; |
| 100 } | 98 } |
| 101 if (it->second.rtt_cb.is_null()) | 99 if (!it->second.rtt_cb.is_null()) |
| 102 return; | 100 it->second.rtt_cb.Run(rtt); |
| 103 it->second.rtt_cb.Run( | |
| 104 rtt_report.rtt, | |
| 105 rtt_report.avg_rtt, | |
| 106 rtt_report.min_rtt, | |
| 107 rtt_report.max_rtt); | |
| 108 } | 101 } |
| 109 | 102 |
| 110 void CastTransportSenderIPC::OnRtcpCastMessage( | 103 void CastTransportSenderIPC::OnRtcpCastMessage( |
| 111 uint32 ssrc, | 104 uint32 ssrc, |
| 112 const media::cast::RtcpCastMessage& cast_message) { | 105 const media::cast::RtcpCastMessage& cast_message) { |
| 113 ClientMap::iterator it = clients_.find(ssrc); | 106 ClientMap::iterator it = clients_.find(ssrc); |
| 114 if (it == clients_.end()) { | 107 if (it == clients_.end()) { |
| 115 LOG(ERROR) << "Received cast message from for unknown SSRC: " << ssrc; | 108 LOG(ERROR) << "Received cast message from for unknown SSRC: " << ssrc; |
| 116 return; | 109 return; |
| 117 } | 110 } |
| 118 if (it->second.cast_message_cb.is_null()) | 111 if (it->second.cast_message_cb.is_null()) |
| 119 return; | 112 return; |
| 120 it->second.cast_message_cb.Run(cast_message); | 113 it->second.cast_message_cb.Run(cast_message); |
| 121 } | 114 } |
| 122 | 115 |
| 123 void CastTransportSenderIPC::Send(IPC::Message* message) { | 116 void CastTransportSenderIPC::Send(IPC::Message* message) { |
| 124 if (CastIPCDispatcher::Get()) { | 117 if (CastIPCDispatcher::Get()) { |
| 125 CastIPCDispatcher::Get()->Send(message); | 118 CastIPCDispatcher::Get()->Send(message); |
| 126 } else { | 119 } else { |
| 127 delete message; | 120 delete message; |
| 128 } | 121 } |
| 129 } | 122 } |
| OLD | NEW |