| Index: webrtc/video/payload_router.cc
|
| diff --git a/webrtc/video/payload_router.cc b/webrtc/video/payload_router.cc
|
| index 7957451c2b4db05b3e034dc7f521ba7fc6d28475..fe9db4c78728458398b52ed2d5cc980058529437 100644
|
| --- a/webrtc/video/payload_router.cc
|
| +++ b/webrtc/video/payload_router.cc
|
| @@ -10,6 +10,8 @@
|
|
|
| #include "webrtc/video/payload_router.h"
|
|
|
| +#include "webrtc/base/checks.h"
|
| +#include "webrtc/base/logging.h"
|
| #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
|
| #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
| #include "webrtc/modules/video_coding/include/video_codec_interface.h"
|
| @@ -18,9 +20,38 @@
|
| namespace webrtc {
|
|
|
| namespace {
|
| +// Map information from encoded_image into rtp.
|
| +void CopyEncodedImage(const EncodedImage* encoded_image, RTPVideoHeader* rtp) {
|
| + rtp->rotation = encoded_image->rotation_;
|
| + rtp->content_type = encoded_image->content_type_;
|
| + if (encoded_image->timing_.is_timing_frame) {
|
| + rtp->video_timing.encode_start_delta_ms =
|
| + VideoSendTiming::GetDeltaCappedMs(
|
| + encoded_image->capture_time_ms_,
|
| + encoded_image->timing_.encode_start_ms);
|
| + rtp->video_timing.encode_finish_delta_ms =
|
| + VideoSendTiming::GetDeltaCappedMs(
|
| + encoded_image->capture_time_ms_,
|
| + encoded_image->timing_.encode_finish_ms);
|
| + rtp->video_timing.packetization_finish_delta_ms = 0;
|
| + rtp->video_timing.pacer_exit_delta_ms = 0;
|
| + rtp->video_timing.network_timstamp_delta_ms = 0;
|
| + rtp->video_timing.network2_timstamp_delta_ms = 0;
|
| + rtp->video_timing.is_timing_frame = true;
|
| + } else {
|
| + rtp->video_timing.is_timing_frame = false;
|
| + }
|
| + rtp->playout_delay = encoded_image->playout_delay_;
|
| +}
|
| +
|
| // Map information from info into rtp.
|
| -void CopyCodecSpecific(const CodecSpecificInfo* info, RTPVideoHeader* rtp) {
|
| - RTC_DCHECK(info);
|
| +void CopyCodecSpecific(const CodecSpecificInfo* info,
|
| + const EncodedImage* encoded_image,
|
| + RTPVideoHeader* rtp) {
|
| + CopyEncodedImage(encoded_image, rtp);
|
| + if (!info)
|
| + return;
|
| +
|
| switch (info->codecType) {
|
| case kVideoCodecVP8: {
|
| rtp->codec = kRtpVideoVp8;
|
| @@ -82,6 +113,30 @@ void CopyCodecSpecific(const CodecSpecificInfo* info, RTPVideoHeader* rtp) {
|
| rtp->codec = kRtpVideoGeneric;
|
| rtp->simulcastIdx = info->codecSpecific.generic.simulcast_idx;
|
| return;
|
| + case kVideoCodecStereo: {
|
| + CodecSpecificInfo* codec_specific_info =
|
| + const_cast<CodecSpecificInfo*>(info);
|
| + codec_specific_info->codecType = info->stereoInfo.stereoCodecType;
|
| + CopyCodecSpecific(codec_specific_info, encoded_image, rtp);
|
| +
|
| + rtp->stereoInfo.stereoCodecType = rtp->codec;
|
| + rtp->codec = kRtpVideoStereo;
|
| + rtp->stereoInfo.num_frames = info->stereoInfo.num_frames;
|
| + for (int stereo_idx = 0; stereo_idx < info->stereoInfo.num_frames;
|
| + ++stereo_idx) {
|
| + LOG(LS_ERROR) << __func__;
|
| + rtp->stereoInfo.encoded_images[stereo_idx] =
|
| + info->stereoInfo.encoded_images[stereo_idx];
|
| + rtp->stereoInfo.fragmentations[stereo_idx] =
|
| + info->stereoInfo.fragmentations[stereo_idx];
|
| + RTPVideoHeader* header = new RTPVideoHeader();
|
| + memset(&header, 0, sizeof(RTPVideoHeader));
|
| + CopyCodecSpecific(info->stereoInfo.codec_specific_infos[stereo_idx],
|
| + rtp->stereoInfo.encoded_images[stereo_idx], header);
|
| + rtp->stereoInfo.rtp_video_headers[stereo_idx] = header;
|
| + }
|
| + return;
|
| + }
|
| default:
|
| return;
|
| }
|
| @@ -126,28 +181,7 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
|
|
|
| RTPVideoHeader rtp_video_header;
|
| memset(&rtp_video_header, 0, sizeof(RTPVideoHeader));
|
| - if (codec_specific_info)
|
| - CopyCodecSpecific(codec_specific_info, &rtp_video_header);
|
| - rtp_video_header.rotation = encoded_image.rotation_;
|
| - rtp_video_header.content_type = encoded_image.content_type_;
|
| - if (encoded_image.timing_.is_timing_frame) {
|
| - rtp_video_header.video_timing.encode_start_delta_ms =
|
| - VideoSendTiming::GetDeltaCappedMs(
|
| - encoded_image.capture_time_ms_,
|
| - encoded_image.timing_.encode_start_ms);
|
| - rtp_video_header.video_timing.encode_finish_delta_ms =
|
| - VideoSendTiming::GetDeltaCappedMs(
|
| - encoded_image.capture_time_ms_,
|
| - encoded_image.timing_.encode_finish_ms);
|
| - rtp_video_header.video_timing.packetization_finish_delta_ms = 0;
|
| - rtp_video_header.video_timing.pacer_exit_delta_ms = 0;
|
| - rtp_video_header.video_timing.network_timstamp_delta_ms = 0;
|
| - rtp_video_header.video_timing.network2_timstamp_delta_ms = 0;
|
| - rtp_video_header.video_timing.is_timing_frame = true;
|
| - } else {
|
| - rtp_video_header.video_timing.is_timing_frame = false;
|
| - }
|
| - rtp_video_header.playout_delay = encoded_image.playout_delay_;
|
| + CopyCodecSpecific(codec_specific_info, &encoded_image, &rtp_video_header);
|
|
|
| int stream_index = rtp_video_header.simulcastIdx;
|
| RTC_DCHECK_LT(stream_index, rtp_modules_.size());
|
|
|