Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: chrome/renderer/media/cast_transport_sender_ipc.cc

Issue 532373003: [Cast] RTT clean-up to the max! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 media::cast::CastTransportStatus status) { 88 media::cast::CastTransportStatus status) {
89 status_callback_.Run(status); 89 status_callback_.Run(status);
90 } 90 }
91 91
92 void CastTransportSenderIPC::OnRawEvents( 92 void CastTransportSenderIPC::OnRawEvents(
93 const std::vector<media::cast::PacketEvent>& packet_events, 93 const std::vector<media::cast::PacketEvent>& packet_events,
94 const std::vector<media::cast::FrameEvent>& frame_events) { 94 const std::vector<media::cast::FrameEvent>& frame_events) {
95 raw_events_callback_.Run(packet_events, frame_events); 95 raw_events_callback_.Run(packet_events, frame_events);
96 } 96 }
97 97
98 void CastTransportSenderIPC::OnRtt( 98 void CastTransportSenderIPC::OnRtt(uint32 ssrc, base::TimeDelta rtt) {
99 uint32 ssrc,
100 const media::cast::RtcpRttReport& rtt_report) {
101 ClientMap::iterator it = clients_.find(ssrc); 99 ClientMap::iterator it = clients_.find(ssrc);
102 if (it == clients_.end()) { 100 if (it == clients_.end()) {
103 LOG(ERROR) << "Received RTT report from for unknown SSRC: " << ssrc; 101 LOG(ERROR) << "Received RTT report from for unknown SSRC: " << ssrc;
104 return; 102 return;
105 } 103 }
106 if (it->second.rtt_cb.is_null()) 104 if (!it->second.rtt_cb.is_null())
107 return; 105 it->second.rtt_cb.Run(rtt);
108 it->second.rtt_cb.Run(
109 rtt_report.rtt,
110 rtt_report.avg_rtt,
111 rtt_report.min_rtt,
112 rtt_report.max_rtt);
113 } 106 }
114 107
115 void CastTransportSenderIPC::OnRtcpCastMessage( 108 void CastTransportSenderIPC::OnRtcpCastMessage(
116 uint32 ssrc, 109 uint32 ssrc,
117 const media::cast::RtcpCastMessage& cast_message) { 110 const media::cast::RtcpCastMessage& cast_message) {
118 ClientMap::iterator it = clients_.find(ssrc); 111 ClientMap::iterator it = clients_.find(ssrc);
119 if (it == clients_.end()) { 112 if (it == clients_.end()) {
120 LOG(ERROR) << "Received cast message from for unknown SSRC: " << ssrc; 113 LOG(ERROR) << "Received cast message from for unknown SSRC: " << ssrc;
121 return; 114 return;
122 } 115 }
123 if (it->second.cast_message_cb.is_null()) 116 if (it->second.cast_message_cb.is_null())
124 return; 117 return;
125 it->second.cast_message_cb.Run(cast_message); 118 it->second.cast_message_cb.Run(cast_message);
126 } 119 }
127 120
128 void CastTransportSenderIPC::Send(IPC::Message* message) { 121 void CastTransportSenderIPC::Send(IPC::Message* message) {
129 if (CastIPCDispatcher::Get()) { 122 if (CastIPCDispatcher::Get()) {
130 CastIPCDispatcher::Get()->Send(message); 123 CastIPCDispatcher::Get()->Send(message);
131 } else { 124 } else {
132 delete message; 125 delete message;
133 } 126 }
134 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698