OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 : max_payload_len_); | 204 : max_payload_len_); |
205 int bytes = WriteHeaderAndPayload(packet_info, buffer, max_payload_len_); | 205 int bytes = WriteHeaderAndPayload(packet_info, buffer, max_payload_len_); |
206 if (bytes < 0) { | 206 if (bytes < 0) { |
207 return false; | 207 return false; |
208 } | 208 } |
209 packet->SetPayloadSize(bytes); | 209 packet->SetPayloadSize(bytes); |
210 packet->SetMarker(packets_.empty()); | 210 packet->SetMarker(packets_.empty()); |
211 return true; | 211 return true; |
212 } | 212 } |
213 | 213 |
214 ProtectionType RtpPacketizerVp8::GetProtectionType() { | |
215 bool protect = | |
216 hdr_info_.temporalIdx == 0 || hdr_info_.temporalIdx == kNoTemporalIdx; | |
217 return protect ? kProtectedPacket : kUnprotectedPacket; | |
218 } | |
219 | |
220 StorageType RtpPacketizerVp8::GetStorageType(uint32_t retransmission_settings) { | |
221 if (hdr_info_.temporalIdx == 0 && | |
222 !(retransmission_settings & kRetransmitBaseLayer)) { | |
223 return kDontRetransmit; | |
224 } | |
225 if (hdr_info_.temporalIdx != kNoTemporalIdx && | |
226 hdr_info_.temporalIdx > 0 && | |
227 !(retransmission_settings & kRetransmitHigherLayers)) { | |
228 return kDontRetransmit; | |
229 } | |
230 return kAllowRetransmission; | |
231 } | |
232 | |
233 std::string RtpPacketizerVp8::ToString() { | 214 std::string RtpPacketizerVp8::ToString() { |
234 return "RtpPacketizerVp8"; | 215 return "RtpPacketizerVp8"; |
235 } | 216 } |
236 | 217 |
237 int RtpPacketizerVp8::GeneratePackets() { | 218 int RtpPacketizerVp8::GeneratePackets() { |
238 if (max_payload_len_ < vp8_fixed_payload_descriptor_bytes_ + | 219 if (max_payload_len_ < vp8_fixed_payload_descriptor_bytes_ + |
239 PayloadDescriptorExtraLength() + 1 + | 220 PayloadDescriptorExtraLength() + 1 + |
240 last_packet_reduction_len_) { | 221 last_packet_reduction_len_) { |
241 // The provided payload length is not long enough for the payload | 222 // The provided payload length is not long enough for the payload |
242 // descriptor and one payload byte in the last packet. | 223 // descriptor and one payload byte in the last packet. |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 if (ParseVP8FrameSize(parsed_payload, payload_data, payload_data_length) != | 676 if (ParseVP8FrameSize(parsed_payload, payload_data, payload_data_length) != |
696 0) { | 677 0) { |
697 return false; | 678 return false; |
698 } | 679 } |
699 | 680 |
700 parsed_payload->payload = payload_data; | 681 parsed_payload->payload = payload_data; |
701 parsed_payload->payload_length = payload_data_length; | 682 parsed_payload->payload_length = payload_data_length; |
702 return true; | 683 return true; |
703 } | 684 } |
704 } // namespace webrtc | 685 } // namespace webrtc |
OLD | NEW |