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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 rtc::CritScope cs(&crit_); | |
magjed_webrtc
2016/11/10 10:04:03
Can you easily merge this crit scope with the othe
danilchap
2016/11/10 10:14:53
no, it is not that easy unfortunately:
extensions
danilchap
2016/11/10 10:17:32
on a second though I'm wrong, it is not hard: just
kthelgason
2016/11/10 10:38:26
Is there a good reason to not just lock during the
danilchap
2016/11/10 10:56:44
It is too dangerous:
SendVideoPacket* functions ma
| |
270 VideoRotation current_rotation = video_header->rotation; | 268 VideoRotation current_rotation = video_header->rotation; |
271 if (frame_type == kVideoFrameKey || current_rotation != last_rotation_ || | 269 if (frame_type == kVideoFrameKey || current_rotation != last_rotation_ || |
272 current_rotation != kVideoRotation_0) | 270 current_rotation != kVideoRotation_0) |
273 rtp_header->SetExtension<VideoOrientation>(current_rotation); | 271 rtp_header->SetExtension<VideoOrientation>(current_rotation); |
274 last_rotation_ = current_rotation; | 272 last_rotation_ = current_rotation; |
275 } | 273 } |
276 | 274 |
277 size_t packet_capacity = rtp_sender_->MaxPayloadLength() - | 275 size_t packet_capacity = rtp_sender_->MaxPayloadLength() - |
278 FecPacketOverhead() - | 276 FecPacketOverhead() - |
279 (rtp_sender_->RtxStatus() ? kRtxHeaderSize : 0); | 277 (rtp_sender_->RtxStatus() ? kRtxHeaderSize : 0); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 rtc::CritScope cs(&crit_); | 358 rtc::CritScope cs(&crit_); |
361 return retransmission_settings_; | 359 return retransmission_settings_; |
362 } | 360 } |
363 | 361 |
364 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 362 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
365 rtc::CritScope cs(&crit_); | 363 rtc::CritScope cs(&crit_); |
366 retransmission_settings_ = settings; | 364 retransmission_settings_ = settings; |
367 } | 365 } |
368 | 366 |
369 } // namespace webrtc | 367 } // namespace webrtc |
OLD | NEW |