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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc

Issue 2452583002: Follow standard sending CVO rtp header extension (Closed)
Patch Set: -now unused helper Created 4 years, 1 month 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/modules/rtp_rtcp/source/rtp_sender_video.h ('k') | no next file » | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 red_payload[0] = media_packet.PayloadType(); 42 red_payload[0] = media_packet.PayloadType();
43 memcpy(&red_payload[kRedForFecHeaderLength], media_packet.payload(), 43 memcpy(&red_payload[kRedForFecHeaderLength], media_packet.payload(),
44 media_packet.payload_size()); 44 media_packet.payload_size());
45 } 45 }
46 } // namespace 46 } // namespace
47 47
48 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSender* rtp_sender) 48 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSender* rtp_sender)
49 : rtp_sender_(rtp_sender), 49 : rtp_sender_(rtp_sender),
50 clock_(clock), 50 clock_(clock),
51 fec_bitrate_(1000, RateStatistics::kBpsScale), 51 fec_bitrate_(1000, RateStatistics::kBpsScale),
52 video_bitrate_(1000, RateStatistics::kBpsScale) {} 52 video_bitrate_(1000, RateStatistics::kBpsScale) {
53 encoder_checker_.Detach();
54 }
53 55
54 RTPSenderVideo::~RTPSenderVideo() {} 56 RTPSenderVideo::~RTPSenderVideo() {}
55 57
56 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) { 58 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) {
57 video_type_ = video_type; 59 video_type_ = video_type;
58 } 60 }
59 61
60 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const { 62 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const {
61 return video_type_; 63 return video_type_;
62 } 64 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 223
222 bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type, 224 bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type,
223 FrameType frame_type, 225 FrameType frame_type,
224 int8_t payload_type, 226 int8_t payload_type,
225 uint32_t rtp_timestamp, 227 uint32_t rtp_timestamp,
226 int64_t capture_time_ms, 228 int64_t capture_time_ms,
227 const uint8_t* payload_data, 229 const uint8_t* payload_data,
228 size_t payload_size, 230 size_t payload_size,
229 const RTPFragmentationHeader* fragmentation, 231 const RTPFragmentationHeader* fragmentation,
230 const RTPVideoHeader* video_header) { 232 const RTPVideoHeader* video_header) {
233 RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_checker_);
231 if (payload_size == 0) 234 if (payload_size == 0)
232 return false; 235 return false;
233 236
234 // Create header that will be reused in all packets. 237 // Create header that will be reused in all packets.
235 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket(); 238 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket();
236 rtp_header->SetPayloadType(payload_type); 239 rtp_header->SetPayloadType(payload_type);
237 rtp_header->SetTimestamp(rtp_timestamp); 240 rtp_header->SetTimestamp(rtp_timestamp);
238 rtp_header->set_capture_time_ms(capture_time_ms); 241 rtp_header->set_capture_time_ms(capture_time_ms);
239 // According to 242 // According to
240 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ 243 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
241 // ts_126114v120700p.pdf Section 7.4.5: 244 // ts_126114v120700p.pdf Section 7.4.5:
242 // The MTSI client shall add the payload bytes as defined in this clause 245 // The MTSI client shall add the payload bytes as defined in this clause
243 // onto the last RTP packet in each group of packets which make up a key 246 // onto the last RTP packet in each group of packets which make up a key
244 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 247 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265
245 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP 248 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP
246 // packet in each group of packets which make up another type of frame 249 // packet in each group of packets which make up another type of frame
247 // (e.g. a P-Frame) only if the current value is different from the previous 250 // (e.g. a P-Frame) only if the current value is different from the previous
248 // value sent. 251 // value sent.
249 // Here we are adding it to every packet of every frame at this point. 252 if (video_header) {
250 if (video_header && video_header->rotation != kVideoRotation_0) 253 // Set rotation when key frame or when changed (to follow standard).
251 rtp_header->SetExtension<VideoOrientation>(video_header->rotation); 254 // Or when different from 0 (to follow current receiver implementation).
255 VideoRotation current_rotation = video_header->rotation;
256 if (frame_type == kVideoFrameKey || current_rotation != last_rotation_ ||
257 current_rotation != kVideoRotation_0)
258 rtp_header->SetExtension<VideoOrientation>(current_rotation);
259 last_rotation_ = current_rotation;
260 }
252 261
253 size_t packet_capacity = rtp_sender_->MaxPayloadLength() - 262 size_t packet_capacity = rtp_sender_->MaxPayloadLength() -
254 FecPacketOverhead() - 263 FecPacketOverhead() -
255 (rtp_sender_->RtxStatus() ? kRtxHeaderSize : 0); 264 (rtp_sender_->RtxStatus() ? kRtxHeaderSize : 0);
256 RTC_DCHECK_LE(packet_capacity, rtp_header->capacity()); 265 RTC_DCHECK_LE(packet_capacity, rtp_header->capacity());
257 RTC_DCHECK_GT(packet_capacity, rtp_header->headers_size()); 266 RTC_DCHECK_GT(packet_capacity, rtp_header->headers_size());
258 size_t max_data_payload_length = packet_capacity - rtp_header->headers_size(); 267 size_t max_data_payload_length = packet_capacity - rtp_header->headers_size();
259 268
260 std::unique_ptr<RtpPacketizer> packetizer(RtpPacketizer::Create( 269 std::unique_ptr<RtpPacketizer> packetizer(RtpPacketizer::Create(
261 video_type, max_data_payload_length, 270 video_type, max_data_payload_length,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 rtc::CritScope cs(&crit_); 345 rtc::CritScope cs(&crit_);
337 return retransmission_settings_; 346 return retransmission_settings_;
338 } 347 }
339 348
340 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { 349 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) {
341 rtc::CritScope cs(&crit_); 350 rtc::CritScope cs(&crit_);
342 retransmission_settings_ = settings; 351 retransmission_settings_ = settings;
343 } 352 }
344 353
345 } // namespace webrtc 354 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_video.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698