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

Side by Side Diff: webrtc/video/payload_router.cc

Issue 2089773002: Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 4 years, 4 months 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/video/payload_router.h ('k') | webrtc/video/payload_router_unittest.cc » ('j') | 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) 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 rtp_modules_[i]->SetSendingStatus(active_); 130 rtp_modules_[i]->SetSendingStatus(active_);
131 rtp_modules_[i]->SetSendingMediaStatus(active_); 131 rtp_modules_[i]->SetSendingMediaStatus(active_);
132 } 132 }
133 // Disable inactive modules. 133 // Disable inactive modules.
134 for (size_t i = num_sending_modules_; i < rtp_modules_.size(); ++i) { 134 for (size_t i = num_sending_modules_; i < rtp_modules_.size(); ++i) {
135 rtp_modules_[i]->SetSendingStatus(false); 135 rtp_modules_[i]->SetSendingStatus(false);
136 rtp_modules_[i]->SetSendingMediaStatus(false); 136 rtp_modules_[i]->SetSendingMediaStatus(false);
137 } 137 }
138 } 138 }
139 139
140 int32_t PayloadRouter::Encoded(const EncodedImage& encoded_image, 140 EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
141 const CodecSpecificInfo* codec_specific_info, 141 const EncodedImage& encoded_image,
142 const RTPFragmentationHeader* fragmentation) { 142 const CodecSpecificInfo* codec_specific_info,
143 const RTPFragmentationHeader* fragmentation) {
143 rtc::CritScope lock(&crit_); 144 rtc::CritScope lock(&crit_);
144 RTC_DCHECK(!rtp_modules_.empty()); 145 RTC_DCHECK(!rtp_modules_.empty());
145 if (!active_ || num_sending_modules_ == 0) 146 if (!active_ || num_sending_modules_ == 0)
146 return -1; 147 return Result(Result::ERROR_SEND_FAILED);
147 148
148 int stream_idx = 0; 149 int stream_index = 0;
149 150
150 RTPVideoHeader rtp_video_header; 151 RTPVideoHeader rtp_video_header;
151 memset(&rtp_video_header, 0, sizeof(RTPVideoHeader)); 152 memset(&rtp_video_header, 0, sizeof(RTPVideoHeader));
152 if (codec_specific_info) 153 if (codec_specific_info)
153 CopyCodecSpecific(codec_specific_info, &rtp_video_header); 154 CopyCodecSpecific(codec_specific_info, &rtp_video_header);
154 rtp_video_header.rotation = encoded_image.rotation_; 155 rtp_video_header.rotation = encoded_image.rotation_;
155 rtp_video_header.playout_delay = encoded_image.playout_delay_; 156 rtp_video_header.playout_delay = encoded_image.playout_delay_;
156 157
157 RTC_DCHECK_LT(rtp_video_header.simulcastIdx, rtp_modules_.size()); 158 RTC_DCHECK_LT(rtp_video_header.simulcastIdx, rtp_modules_.size());
158 // The simulcast index might actually be larger than the number of modules 159 // The simulcast index might actually be larger than the number of modules
159 // in case the encoder was processing a frame during a codec reconfig. 160 // in case the encoder was processing a frame during a codec reconfig.
160 if (rtp_video_header.simulcastIdx >= num_sending_modules_) 161 if (rtp_video_header.simulcastIdx >= num_sending_modules_)
161 return -1; 162 return Result(Result::ERROR_SEND_FAILED);
162 stream_idx = rtp_video_header.simulcastIdx; 163 stream_index = rtp_video_header.simulcastIdx;
163 164
164 return rtp_modules_[stream_idx]->SendOutgoingData( 165 uint32_t frame_id;
166 int send_result = rtp_modules_[stream_index]->SendOutgoingData(
165 encoded_image._frameType, payload_type_, encoded_image._timeStamp, 167 encoded_image._frameType, payload_type_, encoded_image._timeStamp,
166 encoded_image.capture_time_ms_, encoded_image._buffer, 168 encoded_image.capture_time_ms_, encoded_image._buffer,
167 encoded_image._length, fragmentation, &rtp_video_header); 169 encoded_image._length, fragmentation, &rtp_video_header, &frame_id);
170
171 if (send_result < 0)
172 return Result(Result::ERROR_SEND_FAILED);
173
174 return Result(Result::OK, frame_id);
168 } 175 }
169 176
170 size_t PayloadRouter::MaxPayloadLength() const { 177 size_t PayloadRouter::MaxPayloadLength() const {
171 size_t min_payload_length = DefaultMaxPayloadLength(); 178 size_t min_payload_length = DefaultMaxPayloadLength();
172 rtc::CritScope lock(&crit_); 179 rtc::CritScope lock(&crit_);
173 for (size_t i = 0; i < num_sending_modules_; ++i) { 180 for (size_t i = 0; i < num_sending_modules_; ++i) {
174 size_t module_payload_length = rtp_modules_[i]->MaxDataPayloadLength(); 181 size_t module_payload_length = rtp_modules_[i]->MaxDataPayloadLength();
175 if (module_payload_length < min_payload_length) 182 if (module_payload_length < min_payload_length)
176 min_payload_length = module_payload_length; 183 min_payload_length = module_payload_length;
177 } 184 }
178 return min_payload_length; 185 return min_payload_length;
179 } 186 }
180 187
181 } // namespace webrtc 188 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/payload_router.h ('k') | webrtc/video/payload_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698