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

Unified Diff: webrtc/video/payload_router.cc

Issue 2089773002: Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: sync Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/video/payload_router.cc
diff --git a/webrtc/video/payload_router.cc b/webrtc/video/payload_router.cc
index 21439022c1dc3b69a91c981e63dcd42357def8ca..47ff175f2f7bc346fba2c09a89ada0673a7e6247 100644
--- a/webrtc/video/payload_router.cc
+++ b/webrtc/video/payload_router.cc
@@ -137,15 +137,16 @@ void PayloadRouter::UpdateModuleSendingState() {
}
}
-int32_t PayloadRouter::Encoded(const EncodedImage& encoded_image,
- const CodecSpecificInfo* codec_specific_info,
- const RTPFragmentationHeader* fragmentation) {
+EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
+ const EncodedImage& encoded_image,
+ const CodecSpecificInfo* codec_specific_info,
+ const RTPFragmentationHeader* fragmentation) {
rtc::CritScope lock(&crit_);
RTC_DCHECK(!rtp_modules_.empty());
if (!active_ || num_sending_modules_ == 0)
- return -1;
+ return Result(Result::ERROR_SEND_FAILED);
- int stream_idx = 0;
+ int stream_index = 0;
RTPVideoHeader rtp_video_header;
memset(&rtp_video_header, 0, sizeof(RTPVideoHeader));
@@ -158,13 +159,20 @@ int32_t PayloadRouter::Encoded(const EncodedImage& encoded_image,
// The simulcast index might actually be larger than the number of modules
// in case the encoder was processing a frame during a codec reconfig.
if (rtp_video_header.simulcastIdx >= num_sending_modules_)
- return -1;
- stream_idx = rtp_video_header.simulcastIdx;
+ return Result(Result::ERROR_SEND_FAILED);
+ stream_index = rtp_video_header.simulcastIdx;
- return rtp_modules_[stream_idx]->SendOutgoingData(
- encoded_image._frameType, payload_type_, encoded_image._timeStamp,
- encoded_image.capture_time_ms_, encoded_image._buffer,
- encoded_image._length, fragmentation, &rtp_video_header);
+ int send_result = rtp_modules_[stream_index]->SendOutgoingData(
+ encoded_image._frameType, payload_type_, encoded_image._timeStamp,
+ encoded_image.capture_time_ms_, encoded_image._buffer,
+ encoded_image._length, fragmentation, &rtp_video_header);
+
+ if (send_result < 0)
+ return Result(Result::ERROR_SEND_FAILED);
+
+ uint32_t frame_id =
+ rtp_modules_[stream_index]->StartTimestamp() + encoded_image._timeStamp;
stefan-webrtc 2016/07/18 16:51:27 Would it make sense to instead have SendOutgoingDa
Sergey Ulanov 2016/07/21 00:09:39 Yes, but RtpRtcp::SendOutgoingData() is used in bu
stefan-webrtc 2016/07/25 15:19:33 Missed this comment, sorry. I would prefer to add
Sergey Ulanov 2016/07/26 19:19:53 Done
+ return Result(Result::OK, frame_id);
}
void PayloadRouter::SetTargetSendBitrate(uint32_t bitrate_bps) {

Powered by Google App Engine
This is Rietveld 408576698