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

Side by Side Diff: webrtc/video/rtp_stream_receiver.cc

Issue 2641463002: Unit test out of band H264 SPS,PPS within RtpStreamReceiver. (Closed)
Patch Set: Rebase. Created 3 years, 11 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/video/BUILD.gn ('k') | webrtc/video/rtp_stream_receiver_unittest.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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 RtpStreamReceiver::~RtpStreamReceiver() { 208 RtpStreamReceiver::~RtpStreamReceiver() {
209 process_thread_->DeRegisterModule(rtp_rtcp_.get()); 209 process_thread_->DeRegisterModule(rtp_rtcp_.get());
210 210
211 if (jitter_buffer_experiment_) 211 if (jitter_buffer_experiment_)
212 process_thread_->DeRegisterModule(nack_module_.get()); 212 process_thread_->DeRegisterModule(nack_module_.get());
213 213
214 packet_router_->RemoveRtpModule(rtp_rtcp_.get()); 214 packet_router_->RemoveRtpModule(rtp_rtcp_.get());
215 rtp_rtcp_->SetREMBStatus(false); 215 rtp_rtcp_->SetREMBStatus(false);
216 remb_->RemoveReceiveChannel(rtp_rtcp_.get()); 216 if (config_.rtp.remb) {
217 remb_->RemoveReceiveChannel(rtp_rtcp_.get());
218 }
217 UpdateHistograms(); 219 UpdateHistograms();
218 } 220 }
219 221
220 bool RtpStreamReceiver::AddReceiveCodec( 222 bool RtpStreamReceiver::AddReceiveCodec(
221 const VideoCodec& video_codec, 223 const VideoCodec& video_codec,
222 const std::map<std::string, std::string>& codec_params) { 224 const std::map<std::string, std::string>& codec_params) {
223 pt_codec_params_.insert(make_pair(video_codec.plType, codec_params)); 225 pt_codec_params_.insert(make_pair(video_codec.plType, codec_params));
224 return AddReceiveCodec(video_codec); 226 return AddReceiveCodec(video_codec);
225 } 227 }
226 228
(...skipping 15 matching lines...) Expand all
242 } 244 }
243 245
244 RtpReceiver* RtpStreamReceiver::GetRtpReceiver() const { 246 RtpReceiver* RtpStreamReceiver::GetRtpReceiver() const {
245 return rtp_receiver_.get(); 247 return rtp_receiver_.get();
246 } 248 }
247 249
248 int32_t RtpStreamReceiver::OnReceivedPayloadData( 250 int32_t RtpStreamReceiver::OnReceivedPayloadData(
249 const uint8_t* payload_data, 251 const uint8_t* payload_data,
250 size_t payload_size, 252 size_t payload_size,
251 const WebRtcRTPHeader* rtp_header) { 253 const WebRtcRTPHeader* rtp_header) {
252 RTC_DCHECK(video_receiver_);
253 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; 254 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header;
254 rtp_header_with_ntp.ntp_time_ms = 255 rtp_header_with_ntp.ntp_time_ms =
255 ntp_estimator_.Estimate(rtp_header->header.timestamp); 256 ntp_estimator_.Estimate(rtp_header->header.timestamp);
256 if (jitter_buffer_experiment_) { 257 if (jitter_buffer_experiment_) {
257 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp); 258 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp);
258 timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds()); 259 timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds());
259 packet.timesNacked = nack_module_->OnReceivedPacket(packet); 260 packet.timesNacked = nack_module_->OnReceivedPacket(packet);
260 261
261 if (packet.codec == kVideoCodecH264) { 262 if (packet.codec == kVideoCodecH264) {
262 // Only when we start to receive packets will we know what payload type 263 // Only when we start to receive packets will we know what payload type
(...skipping 14 matching lines...) Expand all
277 break; 278 break;
278 } 279 }
279 } else { 280 } else {
280 uint8_t* data = new uint8_t[packet.sizeBytes]; 281 uint8_t* data = new uint8_t[packet.sizeBytes];
281 memcpy(data, packet.dataPtr, packet.sizeBytes); 282 memcpy(data, packet.dataPtr, packet.sizeBytes);
282 packet.dataPtr = data; 283 packet.dataPtr = data;
283 } 284 }
284 285
285 packet_buffer_->InsertPacket(&packet); 286 packet_buffer_->InsertPacket(&packet);
286 } else { 287 } else {
288 RTC_DCHECK(video_receiver_);
287 if (video_receiver_->IncomingPacket(payload_data, payload_size, 289 if (video_receiver_->IncomingPacket(payload_data, payload_size,
288 rtp_header_with_ntp) != 0) { 290 rtp_header_with_ntp) != 0) {
289 // Check this... 291 // Check this...
290 return -1; 292 return -1;
291 } 293 }
292 } 294 }
293 return 0; 295 return 0;
294 } 296 }
295 297
296 bool RtpStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet, 298 bool RtpStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet,
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( 659 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension(
658 StringToRtpExtensionType(extension), id)); 660 StringToRtpExtensionType(extension), id));
659 } 661 }
660 662
661 void RtpStreamReceiver::InsertSpsPpsIntoTracker(uint8_t payload_type) { 663 void RtpStreamReceiver::InsertSpsPpsIntoTracker(uint8_t payload_type) {
662 auto codec_params_it = pt_codec_params_.find(payload_type); 664 auto codec_params_it = pt_codec_params_.find(payload_type);
663 if (codec_params_it == pt_codec_params_.end()) 665 if (codec_params_it == pt_codec_params_.end())
664 return; 666 return;
665 667
666 LOG(LS_INFO) << "Found out of band supplied codec parameters for" 668 LOG(LS_INFO) << "Found out of band supplied codec parameters for"
667 << " payload type: " << payload_type; 669 << " payload type: " << static_cast<int>(payload_type);
668 670
669 H264SpropParameterSets sprop_decoder; 671 H264SpropParameterSets sprop_decoder;
670 auto sprop_base64_it = 672 auto sprop_base64_it =
671 codec_params_it->second.find(cricket::kH264FmtpSpropParameterSets); 673 codec_params_it->second.find(cricket::kH264FmtpSpropParameterSets);
672 674
673 if (sprop_base64_it == codec_params_it->second.end()) 675 if (sprop_base64_it == codec_params_it->second.end())
674 return; 676 return;
675 677
676 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second)) 678 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str()))
677 return; 679 return;
678 680
679 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), 681 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(),
680 sprop_decoder.pps_nalu()); 682 sprop_decoder.pps_nalu());
681 } 683 }
682 684
683 } // namespace webrtc 685 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | webrtc/video/rtp_stream_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698