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

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

Issue 2495483002: Replace SequencedTaskChecker in RTPSenderVideo (Closed)
Patch Set: Add todo 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 : rtp_sender_(rtp_sender), 48 : rtp_sender_(rtp_sender),
49 clock_(clock), 49 clock_(clock),
50 video_type_(kRtpVideoGeneric), 50 video_type_(kRtpVideoGeneric),
51 retransmission_settings_(kRetransmitBaseLayer), 51 retransmission_settings_(kRetransmitBaseLayer),
52 last_rotation_(kVideoRotation_0), 52 last_rotation_(kVideoRotation_0),
53 red_payload_type_(-1), 53 red_payload_type_(-1),
54 ulpfec_payload_type_(-1), 54 ulpfec_payload_type_(-1),
55 delta_fec_params_{0, 1, kFecMaskRandom}, 55 delta_fec_params_{0, 1, kFecMaskRandom},
56 key_fec_params_{0, 1, kFecMaskRandom}, 56 key_fec_params_{0, 1, kFecMaskRandom},
57 fec_bitrate_(1000, RateStatistics::kBpsScale), 57 fec_bitrate_(1000, RateStatistics::kBpsScale),
58 video_bitrate_(1000, RateStatistics::kBpsScale) { 58 video_bitrate_(1000, RateStatistics::kBpsScale) { }
59 encoder_checker_.Detach();
60 }
61 59
62 RTPSenderVideo::~RTPSenderVideo() {} 60 RTPSenderVideo::~RTPSenderVideo() {}
63 61
64 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) { 62 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) {
65 video_type_ = video_type; 63 video_type_ = video_type;
66 } 64 }
67 65
68 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const { 66 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const {
69 return video_type_; 67 return video_type_;
70 } 68 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 236
239 bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type, 237 bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type,
240 FrameType frame_type, 238 FrameType frame_type,
241 int8_t payload_type, 239 int8_t payload_type,
242 uint32_t rtp_timestamp, 240 uint32_t rtp_timestamp,
243 int64_t capture_time_ms, 241 int64_t capture_time_ms,
244 const uint8_t* payload_data, 242 const uint8_t* payload_data,
245 size_t payload_size, 243 size_t payload_size,
246 const RTPFragmentationHeader* fragmentation, 244 const RTPFragmentationHeader* fragmentation,
247 const RTPVideoHeader* video_header) { 245 const RTPVideoHeader* video_header) {
248 RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_checker_);
249 if (payload_size == 0) 246 if (payload_size == 0)
250 return false; 247 return false;
251 248
252 // Create header that will be reused in all packets. 249 // Create header that will be reused in all packets.
253 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket(); 250 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket();
254 rtp_header->SetPayloadType(payload_type); 251 rtp_header->SetPayloadType(payload_type);
255 rtp_header->SetTimestamp(rtp_timestamp); 252 rtp_header->SetTimestamp(rtp_timestamp);
256 rtp_header->set_capture_time_ms(capture_time_ms); 253 rtp_header->set_capture_time_ms(capture_time_ms);
257 // According to 254 // According to
258 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ 255 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
259 // ts_126114v120700p.pdf Section 7.4.5: 256 // ts_126114v120700p.pdf Section 7.4.5:
260 // The MTSI client shall add the payload bytes as defined in this clause 257 // The MTSI client shall add the payload bytes as defined in this clause
261 // onto the last RTP packet in each group of packets which make up a key 258 // onto the last RTP packet in each group of packets which make up a key
262 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 259 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265
263 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP 260 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP
264 // packet in each group of packets which make up another type of frame 261 // packet in each group of packets which make up another type of frame
265 // (e.g. a P-Frame) only if the current value is different from the previous 262 // (e.g. a P-Frame) only if the current value is different from the previous
266 // value sent. 263 // value sent.
267 if (video_header) { 264 if (video_header) {
268 // Set rotation when key frame or when changed (to follow standard). 265 // Set rotation when key frame or when changed (to follow standard).
269 // Or when different from 0 (to follow current receiver implementation). 266 // Or when different from 0 (to follow current receiver implementation).
267 // TODO(kthelgason): Merge this crit scope with the one below.
268 rtc::CritScope cs(&crit_);
270 VideoRotation current_rotation = video_header->rotation; 269 VideoRotation current_rotation = video_header->rotation;
271 if (frame_type == kVideoFrameKey || current_rotation != last_rotation_ || 270 if (frame_type == kVideoFrameKey || current_rotation != last_rotation_ ||
272 current_rotation != kVideoRotation_0) 271 current_rotation != kVideoRotation_0)
273 rtp_header->SetExtension<VideoOrientation>(current_rotation); 272 rtp_header->SetExtension<VideoOrientation>(current_rotation);
274 last_rotation_ = current_rotation; 273 last_rotation_ = current_rotation;
275 } 274 }
276 275
277 size_t packet_capacity = rtp_sender_->MaxPayloadLength() - 276 size_t packet_capacity = rtp_sender_->MaxPayloadLength() -
278 FecPacketOverhead() - 277 FecPacketOverhead() -
279 (rtp_sender_->RtxStatus() ? kRtxHeaderSize : 0); 278 (rtp_sender_->RtxStatus() ? kRtxHeaderSize : 0);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 rtc::CritScope cs(&crit_); 359 rtc::CritScope cs(&crit_);
361 return retransmission_settings_; 360 return retransmission_settings_;
362 } 361 }
363 362
364 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { 363 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) {
365 rtc::CritScope cs(&crit_); 364 rtc::CritScope cs(&crit_);
366 retransmission_settings_ = settings; 365 retransmission_settings_ = settings;
367 } 366 }
368 367
369 } // namespace webrtc 368 } // 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