| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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/video/video_receive_stream.h" | 11 #include "webrtc/video/video_receive_stream.h" |
| 12 | 12 |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 | 14 |
| 15 #include <set> | 15 #include <set> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <utility> | 17 #include <utility> |
| 18 | 18 |
| 19 #include "webrtc/call/rtp_stream_receiver_controller_interface.h" | 19 #include "webrtc/call/rtp_stream_receiver_controller_interface.h" |
| 20 #include "webrtc/call/rtx_receive_stream.h" | |
| 21 #include "webrtc/common_types.h" | 20 #include "webrtc/common_types.h" |
| 22 #include "webrtc/common_video/h264/profile_level_id.h" | 21 #include "webrtc/common_video/h264/profile_level_id.h" |
| 23 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 22 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
| 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| 26 #include "webrtc/modules/utility/include/process_thread.h" | 25 #include "webrtc/modules/utility/include/process_thread.h" |
| 27 #include "webrtc/modules/video_coding/frame_object.h" | 26 #include "webrtc/modules/video_coding/frame_object.h" |
| 28 #include "webrtc/modules/video_coding/include/video_coding.h" | 27 #include "webrtc/modules/video_coding/include/video_coding.h" |
| 29 #include "webrtc/modules/video_coding/jitter_estimator.h" | 28 #include "webrtc/modules/video_coding/jitter_estimator.h" |
| 30 #include "webrtc/modules/video_coding/timing.h" | 29 #include "webrtc/modules/video_coding/timing.h" |
| 31 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 30 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
| 32 #include "webrtc/rtc_base/checks.h" | 31 #include "webrtc/rtc_base/checks.h" |
| 33 #include "webrtc/rtc_base/location.h" | 32 #include "webrtc/rtc_base/location.h" |
| 34 #include "webrtc/rtc_base/logging.h" | 33 #include "webrtc/rtc_base/logging.h" |
| 35 #include "webrtc/rtc_base/optional.h" | 34 #include "webrtc/rtc_base/optional.h" |
| 36 #include "webrtc/rtc_base/ptr_util.h" | |
| 37 #include "webrtc/rtc_base/trace_event.h" | 35 #include "webrtc/rtc_base/trace_event.h" |
| 38 #include "webrtc/system_wrappers/include/clock.h" | 36 #include "webrtc/system_wrappers/include/clock.h" |
| 39 #include "webrtc/system_wrappers/include/field_trial.h" | 37 #include "webrtc/system_wrappers/include/field_trial.h" |
| 40 #include "webrtc/video/call_stats.h" | 38 #include "webrtc/video/call_stats.h" |
| 41 #include "webrtc/video/receive_statistics_proxy.h" | 39 #include "webrtc/video/receive_statistics_proxy.h" |
| 42 | 40 |
| 43 namespace webrtc { | 41 namespace webrtc { |
| 44 | 42 |
| 45 namespace { | 43 namespace { |
| 46 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) { | 44 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 std::set<int> decoder_payload_types; | 113 std::set<int> decoder_payload_types; |
| 116 for (const Decoder& decoder : config_.decoders) { | 114 for (const Decoder& decoder : config_.decoders) { |
| 117 RTC_CHECK(decoder.decoder); | 115 RTC_CHECK(decoder.decoder); |
| 118 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == | 116 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == |
| 119 decoder_payload_types.end()) | 117 decoder_payload_types.end()) |
| 120 << "Duplicate payload type (" << decoder.payload_type | 118 << "Duplicate payload type (" << decoder.payload_type |
| 121 << ") for different decoders."; | 119 << ") for different decoders."; |
| 122 decoder_payload_types.insert(decoder.payload_type); | 120 decoder_payload_types.insert(decoder.payload_type); |
| 123 } | 121 } |
| 124 | 122 |
| 125 video_receiver_.SetRenderDelay(config_.render_delay_ms); | 123 video_receiver_.SetRenderDelay(config.render_delay_ms); |
| 126 | 124 |
| 127 jitter_estimator_.reset(new VCMJitterEstimator(clock_)); | 125 jitter_estimator_.reset(new VCMJitterEstimator(clock_)); |
| 128 frame_buffer_.reset(new video_coding::FrameBuffer( | 126 frame_buffer_.reset(new video_coding::FrameBuffer( |
| 129 clock_, jitter_estimator_.get(), timing_.get(), &stats_proxy_)); | 127 clock_, jitter_estimator_.get(), timing_.get(), &stats_proxy_)); |
| 130 | 128 |
| 131 process_thread_->RegisterModule(&rtp_stream_sync_, RTC_FROM_HERE); | 129 process_thread_->RegisterModule(&rtp_stream_sync_, RTC_FROM_HERE); |
| 132 | 130 |
| 133 // Register with RtpStreamReceiverController. | 131 // Register with RtpStreamReceiverController. |
| 134 media_receiver_ = receiver_controller->CreateReceiver( | 132 media_receiver_ = receiver_controller->CreateReceiver( |
| 135 config_.rtp.remote_ssrc, &rtp_video_stream_receiver_); | 133 config_.rtp.remote_ssrc, &rtp_video_stream_receiver_); |
| 136 if (config_.rtp.rtx_ssrc) { | 134 if (config.rtp.rtx_ssrc) { |
| 137 rtx_receive_stream_ = rtc::MakeUnique<RtxReceiveStream>( | |
| 138 &rtp_video_stream_receiver_, config.rtp.rtx_associated_payload_types, | |
| 139 config_.rtp.remote_ssrc); | |
| 140 rtx_receiver_ = receiver_controller->CreateReceiver( | 135 rtx_receiver_ = receiver_controller->CreateReceiver( |
| 141 config_.rtp.rtx_ssrc, rtx_receive_stream_.get()); | 136 config_.rtp.rtx_ssrc, &rtp_video_stream_receiver_); |
| 142 } | 137 } |
| 143 } | 138 } |
| 144 | 139 |
| 145 VideoReceiveStream::~VideoReceiveStream() { | 140 VideoReceiveStream::~VideoReceiveStream() { |
| 146 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); | 141 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); |
| 147 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); | 142 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); |
| 148 Stop(); | 143 Stop(); |
| 149 | 144 |
| 150 process_thread_->DeRegisterModule(&rtp_stream_sync_); | 145 process_thread_->DeRegisterModule(&rtp_stream_sync_); |
| 151 } | 146 } |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 if (stream_is_active && !receiving_keyframe) { | 442 if (stream_is_active && !receiving_keyframe) { |
| 448 LOG(LS_WARNING) << "No decodable frame in " << wait_ms | 443 LOG(LS_WARNING) << "No decodable frame in " << wait_ms |
| 449 << " ms, requesting keyframe."; | 444 << " ms, requesting keyframe."; |
| 450 RequestKeyFrame(); | 445 RequestKeyFrame(); |
| 451 } | 446 } |
| 452 } | 447 } |
| 453 return true; | 448 return true; |
| 454 } | 449 } |
| 455 } // namespace internal | 450 } // namespace internal |
| 456 } // namespace webrtc | 451 } // namespace webrtc |
| OLD | NEW |