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

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: Add bitstream expectations and rebase on https://codereview.webrtc.org/2638933002/ . 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
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 RtpStreamReceiver::~RtpStreamReceiver() { 216 RtpStreamReceiver::~RtpStreamReceiver() {
217 process_thread_->DeRegisterModule(rtp_rtcp_.get()); 217 process_thread_->DeRegisterModule(rtp_rtcp_.get());
218 218
219 if (jitter_buffer_experiment_) 219 if (jitter_buffer_experiment_)
220 process_thread_->DeRegisterModule(nack_module_.get()); 220 process_thread_->DeRegisterModule(nack_module_.get());
221 221
222 packet_router_->RemoveRtpModule(rtp_rtcp_.get()); 222 packet_router_->RemoveRtpModule(rtp_rtcp_.get());
223 rtp_rtcp_->SetREMBStatus(false); 223 rtp_rtcp_->SetREMBStatus(false);
224 remb_->RemoveReceiveChannel(rtp_rtcp_.get()); 224 if (config_.rtp.remb) {
225 remb_->RemoveReceiveChannel(rtp_rtcp_.get());
226 }
225 UpdateHistograms(); 227 UpdateHistograms();
226 } 228 }
227 229
228 bool RtpStreamReceiver::AddReceiveCodec( 230 bool RtpStreamReceiver::AddReceiveCodec(
229 const VideoCodec& video_codec, 231 const VideoCodec& video_codec,
230 const std::map<std::string, std::string>& codec_params) { 232 const std::map<std::string, std::string>& codec_params) {
231 pt_codec_params_.insert(make_pair(video_codec.plType, codec_params)); 233 pt_codec_params_.insert(make_pair(video_codec.plType, codec_params));
232 return AddReceiveCodec(video_codec); 234 return AddReceiveCodec(video_codec);
233 } 235 }
234 236
(...skipping 15 matching lines...) Expand all
250 } 252 }
251 253
252 RtpReceiver* RtpStreamReceiver::GetRtpReceiver() const { 254 RtpReceiver* RtpStreamReceiver::GetRtpReceiver() const {
253 return rtp_receiver_.get(); 255 return rtp_receiver_.get();
254 } 256 }
255 257
256 int32_t RtpStreamReceiver::OnReceivedPayloadData( 258 int32_t RtpStreamReceiver::OnReceivedPayloadData(
257 const uint8_t* payload_data, 259 const uint8_t* payload_data,
258 size_t payload_size, 260 size_t payload_size,
259 const WebRtcRTPHeader* rtp_header) { 261 const WebRtcRTPHeader* rtp_header) {
260 RTC_DCHECK(video_receiver_);
261 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; 262 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header;
262 rtp_header_with_ntp.ntp_time_ms = 263 rtp_header_with_ntp.ntp_time_ms =
263 ntp_estimator_.Estimate(rtp_header->header.timestamp); 264 ntp_estimator_.Estimate(rtp_header->header.timestamp);
264 if (jitter_buffer_experiment_) { 265 if (jitter_buffer_experiment_) {
265 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp); 266 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp);
266 timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds()); 267 timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds());
267 packet.timesNacked = nack_module_->OnReceivedPacket(packet); 268 packet.timesNacked = nack_module_->OnReceivedPacket(packet);
268 269
269 if (packet.codec == kVideoCodecH264) { 270 if (packet.codec == kVideoCodecH264) {
270 // Only when we start to receive packets will we know what payload type 271 // Only when we start to receive packets will we know what payload type
(...skipping 14 matching lines...) Expand all
285 break; 286 break;
286 } 287 }
287 } else { 288 } else {
288 uint8_t* data = new uint8_t[packet.sizeBytes]; 289 uint8_t* data = new uint8_t[packet.sizeBytes];
289 memcpy(data, packet.dataPtr, packet.sizeBytes); 290 memcpy(data, packet.dataPtr, packet.sizeBytes);
290 packet.dataPtr = data; 291 packet.dataPtr = data;
291 } 292 }
292 293
293 packet_buffer_->InsertPacket(&packet); 294 packet_buffer_->InsertPacket(&packet);
294 } else { 295 } else {
296 RTC_DCHECK(video_receiver_);
295 if (video_receiver_->IncomingPacket(payload_data, payload_size, 297 if (video_receiver_->IncomingPacket(payload_data, payload_size,
296 rtp_header_with_ntp) != 0) { 298 rtp_header_with_ntp) != 0) {
297 // Check this... 299 // Check this...
298 return -1; 300 return -1;
299 } 301 }
300 } 302 }
301 return 0; 303 return 0;
302 } 304 }
303 305
304 bool RtpStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet, 306 bool RtpStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet,
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( 667 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension(
666 StringToRtpExtensionType(extension), id)); 668 StringToRtpExtensionType(extension), id));
667 } 669 }
668 670
669 void RtpStreamReceiver::InsertSpsPpsIntoTracker(uint8_t payload_type) { 671 void RtpStreamReceiver::InsertSpsPpsIntoTracker(uint8_t payload_type) {
670 auto codec_params_it = pt_codec_params_.find(payload_type); 672 auto codec_params_it = pt_codec_params_.find(payload_type);
671 if (codec_params_it == pt_codec_params_.end()) 673 if (codec_params_it == pt_codec_params_.end())
672 return; 674 return;
673 675
674 LOG(LS_INFO) << "Found out of band supplied codec parameters for" 676 LOG(LS_INFO) << "Found out of band supplied codec parameters for"
675 << " payload type: " << payload_type; 677 << " payload type: " << (uint32_t)payload_type;
676 678
677 H264SpropParameterSets sprop_decoder; 679 H264SpropParameterSets sprop_decoder;
678 auto sprop_base64_it = 680 auto sprop_base64_it =
679 codec_params_it->second.find(cricket::kH264FmtpSpropParameterSets); 681 codec_params_it->second.find(cricket::kH264FmtpSpropParameterSets);
680 682
681 if (sprop_base64_it == codec_params_it->second.end()) 683 if (sprop_base64_it == codec_params_it->second.end())
682 return; 684 return;
683 685
684 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second)) 686 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str()))
685 return; 687 return;
686 688
687 tracker_.InsertSpsPps(sprop_decoder.sps_nalu(), sprop_decoder.pps_nalu()); 689 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(),
690 sprop_decoder.pps_nalu());
688 } 691 }
689 692
690 } // namespace webrtc 693 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698