Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 const RTPFragmentationHeader* fragmentation, | 294 const RTPFragmentationHeader* fragmentation, |
| 295 const RTPVideoHeader* video_header) { | 295 const RTPVideoHeader* video_header) { |
| 296 if (payload_size == 0) | 296 if (payload_size == 0) |
| 297 return false; | 297 return false; |
| 298 | 298 |
| 299 // Create header that will be reused in all packets. | 299 // Create header that will be reused in all packets. |
| 300 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket(); | 300 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket(); |
| 301 rtp_header->SetPayloadType(payload_type); | 301 rtp_header->SetPayloadType(payload_type); |
| 302 rtp_header->SetTimestamp(rtp_timestamp); | 302 rtp_header->SetTimestamp(rtp_timestamp); |
| 303 rtp_header->set_capture_time_ms(capture_time_ms); | 303 rtp_header->set_capture_time_ms(capture_time_ms); |
| 304 | |
| 305 // Set Frame Marks | |
|
danilchap
2017/06/28 16:07:07
Prefer to end comments with a '.'
sergio.garcia.murillo
2017/06/29 12:58:58
Acknowledged.
| |
| 306 FrameMarks frame_marks; | |
| 307 bool frame_marking_enabled = true; | |
| 308 | |
| 309 // Common info | |
| 310 frame_marks.startOfFrame = true; | |
| 311 frame_marks.endOfFrame = false; | |
| 312 frame_marks.independent = (frame_type == kVideoFrameKey); | |
| 313 | |
| 314 // Codec specific | |
| 315 switch (video_type) { | |
| 316 case kRtpVideoH264: | |
| 317 // Nothing to add | |
| 318 frame_marks.discardable = false; | |
| 319 frame_marks.temporalLayerId = 0; | |
|
danilchap
2017/06/28 16:07:07
may be kNoTemporalIdx/kNoSpaitalIdx/kNoTl0PicIdx?
sergio.garcia.murillo
2017/06/29 12:58:58
Done.
| |
| 320 frame_marks.spatialLayerId = 0; | |
| 321 frame_marks.tl0PicIdx = 0; | |
| 322 break; | |
| 323 case kRtpVideoVp8: | |
| 324 frame_marks.discardable = video_header->codecHeader.VP8.nonReference; | |
| 325 frame_marks.baseLayerSync = video_header->codecHeader.VP8.layerSync; | |
| 326 frame_marks.temporalLayerId = video_header->codecHeader.VP8.temporalIdx; | |
| 327 frame_marks.spatialLayerId = 0; | |
|
danilchap
2017/06/28 16:07:07
kNoSpatialIdx?
sergio.garcia.murillo
2017/06/29 12:58:58
Done.
| |
| 328 frame_marks.tl0PicIdx = video_header->codecHeader.VP8.tl0PicIdx; | |
| 329 break; | |
| 330 case kRtpVideoVp9: | |
| 331 frame_marks.discardable = false; | |
| 332 frame_marks.temporalLayerId = video_header->codecHeader.VP9.temporal_idx; | |
| 333 frame_marks.spatialLayerId = 0; | |
| 334 frame_marks.tl0PicIdx = video_header->codecHeader.VP9.tl0_pic_idx; | |
| 335 // TODO: This will need to be changed to support VP9 SVC, but videoheader | |
|
danilchap
2017/06/28 16:07:07
add bugnumber or username to TODO()
https://google
| |
| 336 // is set per-frame, not per packet, so we can't have access to this | |
|
danilchap
2017/06/28 16:07:06
this is same for VP8, why is it a problem? SendVid
sergio.garcia.murillo
2017/06/29 12:58:58
No, because in VP8 there is no support for spatial
danilchap
2017/06/29 13:47:26
SendVideo takes layer frame, not super frame for V
sergio.garcia.murillo
2017/06/30 10:09:23
Perfect then.
Side note, wouldn't it still be a p
danilchap
2017/06/30 12:53:25
same struct is used for per-packet vp9 header (whe
| |
| 337 // values. | |
| 338 // Also, small modifications to the extensions will be needed to not | |
| 339 // change size of the extension between sid:0 and sid:1 | |
| 340 // frame_marks.startOfFrame = | |
| 341 // video_header->codecHeader.VP9.beginning_of_frame; | |
| 342 // frame_marks.endOfFrame = video_header->codecHeader.VP9.end_of_frame; | |
| 343 // frame_marks.spatialLayerId = video_header->codecHeader.VP9.spatial_idx; | |
| 344 break; | |
| 345 default: | |
| 346 // Do not use frame marking | |
| 347 frame_marking_enabled = false; | |
| 348 } | |
| 349 // Only add frame marking for known codecs | |
| 350 if (frame_marking_enabled) | |
| 351 // Add extension header for frame marking | |
| 352 rtp_header->SetExtension<FrameMarking>(frame_marks); | |
| 353 | |
| 304 auto last_packet = rtc::MakeUnique<RtpPacketToSend>(*rtp_header); | 354 auto last_packet = rtc::MakeUnique<RtpPacketToSend>(*rtp_header); |
| 305 | 355 |
| 306 size_t fec_packet_overhead; | 356 size_t fec_packet_overhead; |
| 307 bool red_enabled; | 357 bool red_enabled; |
| 308 int32_t retransmission_settings; | 358 int32_t retransmission_settings; |
| 309 { | 359 { |
| 310 rtc::CritScope cs(&crit_); | 360 rtc::CritScope cs(&crit_); |
| 311 // According to | 361 // According to |
| 312 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ | 362 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ |
| 313 // ts_126114v120700p.pdf Section 7.4.5: | 363 // ts_126114v120700p.pdf Section 7.4.5: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 const RTPFragmentationHeader* frag = | 420 const RTPFragmentationHeader* frag = |
| 371 (video_type == kRtpVideoVp8) ? nullptr : fragmentation; | 421 (video_type == kRtpVideoVp8) ? nullptr : fragmentation; |
| 372 size_t num_packets = | 422 size_t num_packets = |
| 373 packetizer->SetPayloadData(payload_data, payload_size, frag); | 423 packetizer->SetPayloadData(payload_data, payload_size, frag); |
| 374 | 424 |
| 375 if (num_packets == 0) | 425 if (num_packets == 0) |
| 376 return false; | 426 return false; |
| 377 | 427 |
| 378 bool first_frame = first_frame_sent_(); | 428 bool first_frame = first_frame_sent_(); |
| 379 for (size_t i = 0; i < num_packets; ++i) { | 429 for (size_t i = 0; i < num_packets; ++i) { |
| 430 bool first = (i == 0); | |
| 380 bool last = (i + 1) == num_packets; | 431 bool last = (i + 1) == num_packets; |
| 381 auto packet = last ? std::move(last_packet) | 432 auto packet = last ? std::move(last_packet) |
| 382 : rtc::MakeUnique<RtpPacketToSend>(*rtp_header); | 433 : rtc::MakeUnique<RtpPacketToSend>(*rtp_header); |
| 383 if (!packetizer->NextPacket(packet.get())) | 434 if (!packetizer->NextPacket(packet.get())) |
| 384 return false; | 435 return false; |
| 385 RTC_DCHECK_LE(packet->payload_size(), | 436 RTC_DCHECK_LE(packet->payload_size(), |
| 386 last ? max_data_payload_length - last_packet_reduction_len | 437 last ? max_data_payload_length - last_packet_reduction_len |
| 387 : max_data_payload_length); | 438 : max_data_payload_length); |
| 439 | |
| 440 // Update start and end marks | |
|
danilchap
2017/06/28 16:07:07
may be put this block inside if (frame_marking_ena
sergio.garcia.murillo
2017/06/29 12:58:58
Done.
| |
| 441 frame_marks.startOfFrame = first; | |
| 442 frame_marks.endOfFrame = last; | |
| 443 | |
| 444 // Only add frame marking for known codecs | |
| 445 if (frame_marking_enabled) | |
| 446 // Update extension header for frame marking | |
| 447 packet->SetExtension<FrameMarking>(frame_marks); | |
| 448 | |
| 388 if (!rtp_sender_->AssignSequenceNumber(packet.get())) | 449 if (!rtp_sender_->AssignSequenceNumber(packet.get())) |
| 389 return false; | 450 return false; |
| 390 | 451 |
| 391 const bool protect_packet = | 452 const bool protect_packet = |
| 392 (packetizer->GetProtectionType() == kProtectedPacket); | 453 (packetizer->GetProtectionType() == kProtectedPacket); |
| 393 if (flexfec_enabled()) { | 454 if (flexfec_enabled()) { |
| 394 // TODO(brandtr): Remove the FlexFEC code path when FlexfecSender | 455 // TODO(brandtr): Remove the FlexFEC code path when FlexfecSender |
| 395 // is wired up to PacedSender instead. | 456 // is wired up to PacedSender instead. |
| 396 SendVideoPacketWithFlexfec(std::move(packet), storage, protect_packet); | 457 SendVideoPacketWithFlexfec(std::move(packet), storage, protect_packet); |
| 397 } else if (red_enabled) { | 458 } else if (red_enabled) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 rtc::CritScope cs(&crit_); | 493 rtc::CritScope cs(&crit_); |
| 433 return retransmission_settings_; | 494 return retransmission_settings_; |
| 434 } | 495 } |
| 435 | 496 |
| 436 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 497 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
| 437 rtc::CritScope cs(&crit_); | 498 rtc::CritScope cs(&crit_); |
| 438 retransmission_settings_ = settings; | 499 retransmission_settings_ = settings; |
| 439 } | 500 } |
| 440 | 501 |
| 441 } // namespace webrtc | 502 } // namespace webrtc |
| OLD | NEW |