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

Side by Side Diff: webrtc/call/call.cc

Issue 2774463003: Don't hardcode MediaType::ANY in FakeNetworkPipe. (Closed)
Patch Set: Update FakeCall::DeliverPacket, for consistency with Call::DeliverRtp. Created 3 years, 9 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
« no previous file with comments | « webrtc/call/bitrate_estimator_tests.cc ('k') | webrtc/call/call_perf_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 1165
1166 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR; 1166 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR;
1167 } 1167 }
1168 1168
1169 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, 1169 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
1170 const uint8_t* packet, 1170 const uint8_t* packet,
1171 size_t length, 1171 size_t length,
1172 const PacketTime& packet_time) { 1172 const PacketTime& packet_time) {
1173 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); 1173 TRACE_EVENT0("webrtc", "Call::DeliverRtp");
1174 1174
1175 RTC_DCHECK(media_type == MediaType::AUDIO || media_type == MediaType::VIDEO);
1176
1175 ReadLockScoped read_lock(*receive_crit_); 1177 ReadLockScoped read_lock(*receive_crit_);
1176 // TODO(nisse): We should parse the RTP header only here, and pass 1178 // TODO(nisse): We should parse the RTP header only here, and pass
1177 // on parsed_packet to the receive streams. 1179 // on parsed_packet to the receive streams.
1178 rtc::Optional<RtpPacketReceived> parsed_packet = 1180 rtc::Optional<RtpPacketReceived> parsed_packet =
1179 ParseRtpPacket(packet, length, packet_time); 1181 ParseRtpPacket(packet, length, packet_time);
1180 1182
1181 if (!parsed_packet) 1183 if (!parsed_packet)
1182 return DELIVERY_PACKET_ERROR; 1184 return DELIVERY_PACKET_ERROR;
1183 1185
1184 NotifyBweOfReceivedPacket(*parsed_packet, media_type); 1186 NotifyBweOfReceivedPacket(*parsed_packet, media_type);
1185 1187
1186 uint32_t ssrc = parsed_packet->Ssrc(); 1188 uint32_t ssrc = parsed_packet->Ssrc();
1187 1189
1188 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { 1190 if (media_type == MediaType::AUDIO) {
1189 auto it = audio_receive_ssrcs_.find(ssrc); 1191 auto it = audio_receive_ssrcs_.find(ssrc);
1190 if (it != audio_receive_ssrcs_.end()) { 1192 if (it != audio_receive_ssrcs_.end()) {
1191 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1193 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1192 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); 1194 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length));
1193 it->second->OnRtpPacket(*parsed_packet); 1195 it->second->OnRtpPacket(*parsed_packet);
1194 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); 1196 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
1195 return DELIVERY_OK; 1197 return DELIVERY_OK;
1196 } 1198 }
1197 } 1199 }
1198 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { 1200 if (media_type == MediaType::VIDEO) {
1199 auto it = video_receive_ssrcs_.find(ssrc); 1201 auto it = video_receive_ssrcs_.find(ssrc);
1200 if (it != video_receive_ssrcs_.end()) { 1202 if (it != video_receive_ssrcs_.end()) {
1201 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1203 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1202 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); 1204 received_video_bytes_per_second_counter_.Add(static_cast<int>(length));
1203 it->second->OnRtpPacket(*parsed_packet); 1205 it->second->OnRtpPacket(*parsed_packet);
1204 1206
1205 // Deliver media packets to FlexFEC subsystem. 1207 // Deliver media packets to FlexFEC subsystem.
1206 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc); 1208 auto it_bounds = flexfec_receive_ssrcs_media_.equal_range(ssrc);
1207 for (auto it = it_bounds.first; it != it_bounds.second; ++it) 1209 for (auto it = it_bounds.first; it != it_bounds.second; ++it)
1208 it->second->OnRtpPacket(*parsed_packet); 1210 it->second->OnRtpPacket(*parsed_packet);
1209 1211
1210 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); 1212 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
1211 return DELIVERY_OK; 1213 return DELIVERY_OK;
1212 } 1214 }
1213 } 1215 }
1214 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { 1216 if (media_type == MediaType::VIDEO) {
1215 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1217 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1216 // TODO(brandtr): Update here when FlexFEC supports protecting audio. 1218 // TODO(brandtr): Update here when FlexFEC supports protecting audio.
1217 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); 1219 received_video_bytes_per_second_counter_.Add(static_cast<int>(length));
1218 auto it = flexfec_receive_ssrcs_protection_.find(ssrc); 1220 auto it = flexfec_receive_ssrcs_protection_.find(ssrc);
1219 if (it != flexfec_receive_ssrcs_protection_.end()) { 1221 if (it != flexfec_receive_ssrcs_protection_.end()) {
1220 it->second->OnRtpPacket(*parsed_packet); 1222 it->second->OnRtpPacket(*parsed_packet);
1221 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); 1223 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
1222 return DELIVERY_OK; 1224 return DELIVERY_OK;
1223 } 1225 }
1224 } 1226 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 if (media_type != MediaType::AUDIO || 1279 if (media_type != MediaType::AUDIO ||
1278 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1280 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1279 receive_side_cc_.OnReceivedPacket( 1281 receive_side_cc_.OnReceivedPacket(
1280 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1282 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1281 header); 1283 header);
1282 } 1284 }
1283 } 1285 }
1284 1286
1285 } // namespace internal 1287 } // namespace internal
1286 } // namespace webrtc 1288 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/bitrate_estimator_tests.cc ('k') | webrtc/call/call_perf_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698