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 |
11 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
| 16 #include "webrtc/base/checks.h" |
16 #include "webrtc/modules/rtp_rtcp/interface/rtp_cvo.h" | 17 #include "webrtc/modules/rtp_rtcp/interface/rtp_cvo.h" |
17 #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h" | 18 #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h" |
18 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" |
19 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h" |
20 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 21 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
21 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 22 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
22 #include "webrtc/system_wrappers/interface/logging.h" | 23 #include "webrtc/system_wrappers/interface/logging.h" |
23 #include "webrtc/system_wrappers/interface/trace_event.h" | 24 #include "webrtc/system_wrappers/interface/trace_event.h" |
24 | 25 |
25 namespace webrtc { | 26 namespace webrtc { |
(...skipping 27 matching lines...) Expand all Loading... |
53 bool is_red, | 54 bool is_red, |
54 const uint8_t* payload, | 55 const uint8_t* payload, |
55 size_t payload_length, | 56 size_t payload_length, |
56 int64_t timestamp_ms, | 57 int64_t timestamp_ms, |
57 bool is_first_packet) { | 58 bool is_first_packet) { |
58 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "Video::ParseRtp", | 59 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "Video::ParseRtp", |
59 "seqnum", rtp_header->header.sequenceNumber, "timestamp", | 60 "seqnum", rtp_header->header.sequenceNumber, "timestamp", |
60 rtp_header->header.timestamp); | 61 rtp_header->header.timestamp); |
61 rtp_header->type.Video.codec = specific_payload.Video.videoCodecType; | 62 rtp_header->type.Video.codec = specific_payload.Video.videoCodecType; |
62 | 63 |
| 64 DCHECK_GE(payload_length, rtp_header->header.paddingLength); |
63 const size_t payload_data_length = | 65 const size_t payload_data_length = |
64 payload_length - rtp_header->header.paddingLength; | 66 payload_length - rtp_header->header.paddingLength; |
65 | 67 |
66 if (payload == NULL || payload_data_length == 0) { | 68 if (payload == NULL || payload_data_length == 0) { |
67 return data_callback_->OnReceivedPayloadData(NULL, 0, rtp_header) == 0 ? 0 | 69 return data_callback_->OnReceivedPayloadData(NULL, 0, rtp_header) == 0 ? 0 |
68 : -1; | 70 : -1; |
69 } | 71 } |
70 | 72 |
71 // We are not allowed to hold a critical section when calling below functions. | 73 // We are not allowed to hold a critical section when calling below functions. |
72 rtc::scoped_ptr<RtpDepacketizer> depacketizer( | 74 rtc::scoped_ptr<RtpDepacketizer> depacketizer( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 callback->OnInitializeDecoder( | 120 callback->OnInitializeDecoder( |
119 id, payload_type, payload_name, kVideoPayloadTypeFrequency, 1, 0)) { | 121 id, payload_type, payload_name, kVideoPayloadTypeFrequency, 1, 0)) { |
120 LOG(LS_ERROR) << "Failed to created decoder for payload type: " | 122 LOG(LS_ERROR) << "Failed to created decoder for payload type: " |
121 << static_cast<int>(payload_type); | 123 << static_cast<int>(payload_type); |
122 return -1; | 124 return -1; |
123 } | 125 } |
124 return 0; | 126 return 0; |
125 } | 127 } |
126 | 128 |
127 } // namespace webrtc | 129 } // namespace webrtc |
OLD | NEW |