| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 EncodedImageCallback::Result PayloadRouter::OnEncodedImage( | 121 EncodedImageCallback::Result PayloadRouter::OnEncodedImage( |
| 122 const EncodedImage& encoded_image, | 122 const EncodedImage& encoded_image, |
| 123 const CodecSpecificInfo* codec_specific_info, | 123 const CodecSpecificInfo* codec_specific_info, |
| 124 const RTPFragmentationHeader* fragmentation) { | 124 const RTPFragmentationHeader* fragmentation) { |
| 125 rtc::CritScope lock(&crit_); | 125 rtc::CritScope lock(&crit_); |
| 126 RTC_DCHECK(!rtp_modules_.empty()); | 126 RTC_DCHECK(!rtp_modules_.empty()); |
| 127 if (!active_) | 127 if (!active_) |
| 128 return Result(Result::ERROR_SEND_FAILED); | 128 return Result(Result::ERROR_SEND_FAILED); |
| 129 | 129 |
| 130 int stream_index = 0; | |
| 131 | |
| 132 RTPVideoHeader rtp_video_header; | 130 RTPVideoHeader rtp_video_header; |
| 133 memset(&rtp_video_header, 0, sizeof(RTPVideoHeader)); | 131 memset(&rtp_video_header, 0, sizeof(RTPVideoHeader)); |
| 134 if (codec_specific_info) | 132 if (codec_specific_info) |
| 135 CopyCodecSpecific(codec_specific_info, &rtp_video_header); | 133 CopyCodecSpecific(codec_specific_info, &rtp_video_header); |
| 136 rtp_video_header.rotation = encoded_image.rotation_; | 134 rtp_video_header.rotation = encoded_image.rotation_; |
| 137 rtp_video_header.playout_delay = encoded_image.playout_delay_; | 135 rtp_video_header.playout_delay = encoded_image.playout_delay_; |
| 138 stream_index = rtp_video_header.simulcastIdx; | |
| 139 | 136 |
| 137 int stream_index = rtp_video_header.simulcastIdx; |
| 138 RTC_DCHECK_LT(stream_index, rtp_modules_.size()); |
| 140 uint32_t frame_id; | 139 uint32_t frame_id; |
| 141 int send_result = rtp_modules_[stream_index]->SendOutgoingData( | 140 bool send_result = rtp_modules_[stream_index]->SendOutgoingData( |
| 142 encoded_image._frameType, payload_type_, encoded_image._timeStamp, | 141 encoded_image._frameType, payload_type_, encoded_image._timeStamp, |
| 143 encoded_image.capture_time_ms_, encoded_image._buffer, | 142 encoded_image.capture_time_ms_, encoded_image._buffer, |
| 144 encoded_image._length, fragmentation, &rtp_video_header, &frame_id); | 143 encoded_image._length, fragmentation, &rtp_video_header, &frame_id); |
| 145 | 144 if (!send_result) |
| 146 RTC_DCHECK_LT(rtp_video_header.simulcastIdx, rtp_modules_.size()); | |
| 147 if (send_result < 0) | |
| 148 return Result(Result::ERROR_SEND_FAILED); | 145 return Result(Result::ERROR_SEND_FAILED); |
| 149 | 146 |
| 150 return Result(Result::OK, frame_id); | 147 return Result(Result::OK, frame_id); |
| 151 } | 148 } |
| 152 | 149 |
| 153 size_t PayloadRouter::MaxPayloadLength() const { | 150 size_t PayloadRouter::MaxPayloadLength() const { |
| 154 size_t min_payload_length = DefaultMaxPayloadLength(); | 151 size_t min_payload_length = DefaultMaxPayloadLength(); |
| 155 rtc::CritScope lock(&crit_); | 152 rtc::CritScope lock(&crit_); |
| 156 for (size_t i = 0; i < rtp_modules_.size(); ++i) { | 153 for (size_t i = 0; i < rtp_modules_.size(); ++i) { |
| 157 size_t module_payload_length = rtp_modules_[i]->MaxDataPayloadLength(); | 154 size_t module_payload_length = rtp_modules_[i]->MaxDataPayloadLength(); |
| 158 if (module_payload_length < min_payload_length) | 155 if (module_payload_length < min_payload_length) |
| 159 min_payload_length = module_payload_length; | 156 min_payload_length = module_payload_length; |
| 160 } | 157 } |
| 161 return min_payload_length; | 158 return min_payload_length; |
| 162 } | 159 } |
| 163 | 160 |
| 164 } // namespace webrtc | 161 } // namespace webrtc |
| OLD | NEW |