Chromium Code Reviews| 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 #include "webrtc/video/video_quality_test.h" | 10 #include "webrtc/video/video_quality_test.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "webrtc/base/cpu_time.h" | 22 #include "webrtc/base/cpu_time.h" |
| 23 #include "webrtc/base/event.h" | 23 #include "webrtc/base/event.h" |
| 24 #include "webrtc/base/format_macros.h" | 24 #include "webrtc/base/format_macros.h" |
| 25 #include "webrtc/base/memory_usage.h" | 25 #include "webrtc/base/memory_usage.h" |
| 26 #include "webrtc/base/optional.h" | 26 #include "webrtc/base/optional.h" |
| 27 #include "webrtc/base/platform_file.h" | 27 #include "webrtc/base/platform_file.h" |
| 28 #include "webrtc/base/timeutils.h" | 28 #include "webrtc/base/timeutils.h" |
| 29 #include "webrtc/call/call.h" | 29 #include "webrtc/call/call.h" |
| 30 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 30 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 31 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 31 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 32 #include "webrtc/media/engine/webrtcvideoengine.h" | |
| 32 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 33 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
| 33 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 34 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 34 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" |
| 35 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 36 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 37 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 37 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 38 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 38 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" | 39 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" |
| 39 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 40 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
| 40 #include "webrtc/system_wrappers/include/cpu_info.h" | 41 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 41 #include "webrtc/system_wrappers/include/field_trial.h" | 42 #include "webrtc/system_wrappers/include/field_trial.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 | 212 |
| 212 ~VideoAnalyzer() { | 213 ~VideoAnalyzer() { |
| 213 for (rtc::PlatformThread* thread : comparison_thread_pool_) { | 214 for (rtc::PlatformThread* thread : comparison_thread_pool_) { |
| 214 thread->Stop(); | 215 thread->Stop(); |
| 215 delete thread; | 216 delete thread; |
| 216 } | 217 } |
| 217 } | 218 } |
| 218 | 219 |
| 219 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } | 220 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } |
| 220 | 221 |
| 222 void SetSource(test::VideoCapturer* video_capturer, bool respectSinkWants) { | |
|
sprang_webrtc
2017/06/16 08:57:23
nit: no camelcase
ilnik
2017/06/16 11:22:48
Done.
| |
| 223 if (respectSinkWants) | |
| 224 captured_frame_forwarder_.SetSource(video_capturer); | |
| 225 rtc::VideoSinkWants wants; | |
| 226 video_capturer->AddOrUpdateSink(InputInterface(), wants); | |
| 227 } | |
| 228 | |
| 221 void SetSendStream(VideoSendStream* stream) { | 229 void SetSendStream(VideoSendStream* stream) { |
| 222 rtc::CritScope lock(&crit_); | 230 rtc::CritScope lock(&crit_); |
| 223 RTC_DCHECK(!send_stream_); | 231 RTC_DCHECK(!send_stream_); |
| 224 send_stream_ = stream; | 232 send_stream_ = stream; |
| 225 } | 233 } |
| 226 | 234 |
| 227 void SetReceiveStream(VideoReceiveStream* stream) { | 235 void SetReceiveStream(VideoReceiveStream* stream) { |
| 228 rtc::CritScope lock(&crit_); | 236 rtc::CritScope lock(&crit_); |
| 229 RTC_DCHECK(!receive_stream_); | 237 RTC_DCHECK(!receive_stream_); |
| 230 receive_stream_ = stream; | 238 receive_stream_ = stream; |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 if (!is_quick_test_enabled_) { | 782 if (!is_quick_test_enabled_) { |
| 775 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); | 783 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); |
| 776 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); | 784 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); |
| 777 } | 785 } |
| 778 } | 786 } |
| 779 | 787 |
| 780 void PerformFrameComparison(const FrameComparison& comparison) { | 788 void PerformFrameComparison(const FrameComparison& comparison) { |
| 781 // Perform expensive psnr and ssim calculations while not holding lock. | 789 // Perform expensive psnr and ssim calculations while not holding lock. |
| 782 double psnr = -1.0; | 790 double psnr = -1.0; |
| 783 double ssim = -1.0; | 791 double ssim = -1.0; |
| 784 if (comparison.reference) { | 792 if (comparison.reference && !comparison.dropped) { |
| 785 psnr = I420PSNR(&*comparison.reference, &*comparison.render); | 793 psnr = I420PSNR(&*comparison.reference, &*comparison.render); |
| 786 ssim = I420SSIM(&*comparison.reference, &*comparison.render); | 794 ssim = I420SSIM(&*comparison.reference, &*comparison.render); |
| 787 } | 795 } |
| 788 | 796 |
| 789 rtc::CritScope crit(&comparison_lock_); | 797 rtc::CritScope crit(&comparison_lock_); |
| 790 if (graph_data_output_file_) { | 798 if (graph_data_output_file_) { |
| 791 samples_.push_back(Sample( | 799 samples_.push_back(Sample( |
| 792 comparison.dropped, comparison.input_time_ms, comparison.send_time_ms, | 800 comparison.dropped, comparison.input_time_ms, comparison.send_time_ms, |
| 793 comparison.recv_time_ms, comparison.render_time_ms, | 801 comparison.recv_time_ms, comparison.render_time_ms, |
| 794 comparison.encoded_frame_size, psnr, ssim)); | 802 comparison.encoded_frame_size, psnr, ssim)); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 894 | 902 |
| 895 // Implements VideoSinkInterface to receive captured frames from a | 903 // Implements VideoSinkInterface to receive captured frames from a |
| 896 // FrameGeneratorCapturer. Implements VideoSourceInterface to be able to act | 904 // FrameGeneratorCapturer. Implements VideoSourceInterface to be able to act |
| 897 // as a source to VideoSendStream. | 905 // as a source to VideoSendStream. |
| 898 // It forwards all input frames to the VideoAnalyzer for later comparison and | 906 // It forwards all input frames to the VideoAnalyzer for later comparison and |
| 899 // forwards the captured frames to the VideoSendStream. | 907 // forwards the captured frames to the VideoSendStream. |
| 900 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>, | 908 class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>, |
| 901 public rtc::VideoSourceInterface<VideoFrame> { | 909 public rtc::VideoSourceInterface<VideoFrame> { |
| 902 public: | 910 public: |
| 903 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer) | 911 explicit CapturedFrameForwarder(VideoAnalyzer* analyzer) |
| 904 : analyzer_(analyzer), send_stream_input_(nullptr) {} | 912 : analyzer_(analyzer), |
| 913 send_stream_input_(nullptr), | |
| 914 video_capturer_(nullptr) {} | |
| 915 | |
| 916 void SetSource(test::VideoCapturer* video_capturer) { | |
| 917 video_capturer_ = video_capturer; | |
| 918 } | |
| 905 | 919 |
| 906 private: | 920 private: |
| 907 void OnFrame(const VideoFrame& video_frame) override { | 921 void OnFrame(const VideoFrame& video_frame) override { |
| 908 VideoFrame copy = video_frame; | 922 VideoFrame copy = video_frame; |
| 909 // Frames from the capturer does not have a rtp timestamp. | 923 // Frames from the capturer does not have a rtp timestamp. |
| 910 // Create one so it can be used for comparison. | 924 // Create one so it can be used for comparison. |
| 911 RTC_DCHECK_EQ(0, video_frame.timestamp()); | 925 RTC_DCHECK_EQ(0, video_frame.timestamp()); |
| 912 if (copy.ntp_time_ms() == 0) | 926 if (video_frame.ntp_time_ms() == 0) |
| 913 copy.set_ntp_time_ms(rtc::TimeMillis()); | 927 copy.set_ntp_time_ms( |
| 928 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds()); | |
|
sprang_webrtc
2017/06/16 08:57:23
Add a member for the clock instance instead of cal
ilnik
2017/06/16 11:22:48
Done.
| |
| 914 copy.set_timestamp(copy.ntp_time_ms() * 90); | 929 copy.set_timestamp(copy.ntp_time_ms() * 90); |
| 915 analyzer_->AddCapturedFrameForComparison(copy); | 930 analyzer_->AddCapturedFrameForComparison(copy); |
| 916 rtc::CritScope lock(&crit_); | 931 rtc::CritScope lock(&crit_); |
| 917 if (send_stream_input_) | 932 if (send_stream_input_) |
| 918 send_stream_input_->OnFrame(copy); | 933 send_stream_input_->OnFrame(copy); |
| 919 } | 934 } |
| 920 | 935 |
| 921 // Called when |send_stream_.SetSource()| is called. | 936 // Called when |send_stream_.SetSource()| is called. |
| 922 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, | 937 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 923 const rtc::VideoSinkWants& wants) override { | 938 const rtc::VideoSinkWants& wants) override { |
| 924 rtc::CritScope lock(&crit_); | 939 rtc::CritScope lock(&crit_); |
| 925 RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink); | 940 RTC_DCHECK(!send_stream_input_ || send_stream_input_ == sink); |
| 926 send_stream_input_ = sink; | 941 send_stream_input_ = sink; |
| 942 if (video_capturer_) { | |
| 943 video_capturer_->AddOrUpdateSink(this, wants); | |
| 944 } | |
| 927 } | 945 } |
| 928 | 946 |
| 929 // Called by |send_stream_| when |send_stream_.SetSource()| is called. | 947 // Called by |send_stream_| when |send_stream_.SetSource()| is called. |
| 930 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override { | 948 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override { |
| 931 rtc::CritScope lock(&crit_); | 949 rtc::CritScope lock(&crit_); |
| 932 RTC_DCHECK(sink == send_stream_input_); | 950 RTC_DCHECK(sink == send_stream_input_); |
| 933 send_stream_input_ = nullptr; | 951 send_stream_input_ = nullptr; |
| 934 } | 952 } |
| 935 | 953 |
| 936 VideoAnalyzer* const analyzer_; | 954 VideoAnalyzer* const analyzer_; |
| 937 rtc::CriticalSection crit_; | 955 rtc::CriticalSection crit_; |
| 938 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_); | 956 rtc::VideoSinkInterface<VideoFrame>* send_stream_input_ GUARDED_BY(crit_); |
| 957 test::VideoCapturer* video_capturer_; | |
| 939 }; | 958 }; |
| 940 | 959 |
| 941 void AddCapturedFrameForComparison(const VideoFrame& video_frame) { | 960 void AddCapturedFrameForComparison(const VideoFrame& video_frame) { |
| 942 rtc::CritScope lock(&crit_); | 961 rtc::CritScope lock(&crit_); |
| 943 frames_.push_back(video_frame); | 962 frames_.push_back(video_frame); |
| 944 } | 963 } |
| 945 | 964 |
| 946 VideoSendStream* send_stream_; | 965 VideoSendStream* send_stream_; |
| 947 VideoReceiveStream* receive_stream_; | 966 VideoReceiveStream* receive_stream_; |
| 948 CapturedFrameForwarder captured_frame_forwarder_; | 967 CapturedFrameForwarder captured_frame_forwarder_; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1230 stream.temporal_layer_thresholds_bps.clear(); | 1249 stream.temporal_layer_thresholds_bps.clear(); |
| 1231 stream.temporal_layer_thresholds_bps.insert( | 1250 stream.temporal_layer_thresholds_bps.insert( |
| 1232 stream.temporal_layer_thresholds_bps.end(), v.begin() + 7, v.end()); | 1251 stream.temporal_layer_thresholds_bps.end(), v.begin() + 7, v.end()); |
| 1233 } else { | 1252 } else { |
| 1234 // Automatic TL thresholds for more than two layers not supported. | 1253 // Automatic TL thresholds for more than two layers not supported. |
| 1235 RTC_CHECK_LE(params->video.num_temporal_layers, 2); | 1254 RTC_CHECK_LE(params->video.num_temporal_layers, 2); |
| 1236 } | 1255 } |
| 1237 params->ss.streams.push_back(stream); | 1256 params->ss.streams.push_back(stream); |
| 1238 } | 1257 } |
| 1239 params->ss.selected_stream = selected_stream; | 1258 params->ss.selected_stream = selected_stream; |
| 1259 params->ss.infer_streams = false; | |
| 1240 | 1260 |
| 1241 params->ss.num_spatial_layers = num_spatial_layers ? num_spatial_layers : 1; | 1261 params->ss.num_spatial_layers = num_spatial_layers ? num_spatial_layers : 1; |
| 1242 params->ss.selected_sl = selected_sl; | 1262 params->ss.selected_sl = selected_sl; |
| 1243 RTC_CHECK(params->ss.spatial_layers.empty()); | 1263 RTC_CHECK(params->ss.spatial_layers.empty()); |
| 1244 for (auto descriptor : sl_descriptors) { | 1264 for (auto descriptor : sl_descriptors) { |
| 1245 if (descriptor.empty()) | 1265 if (descriptor.empty()) |
| 1246 continue; | 1266 continue; |
| 1247 std::vector<int> v = VideoQualityTest::ParseCSV(descriptor); | 1267 std::vector<int> v = VideoQualityTest::ParseCSV(descriptor); |
| 1248 RTC_CHECK_GT(v[2], 0); | 1268 RTC_CHECK_GT(v[2], 0); |
| 1249 | 1269 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1311 | 1331 |
| 1312 video_send_config_.suspend_below_min_bitrate = | 1332 video_send_config_.suspend_below_min_bitrate = |
| 1313 params_.video.suspend_below_min_bitrate; | 1333 params_.video.suspend_below_min_bitrate; |
| 1314 | 1334 |
| 1315 video_encoder_config_.number_of_streams = params_.ss.streams.size(); | 1335 video_encoder_config_.number_of_streams = params_.ss.streams.size(); |
| 1316 video_encoder_config_.max_bitrate_bps = 0; | 1336 video_encoder_config_.max_bitrate_bps = 0; |
| 1317 for (size_t i = 0; i < params_.ss.streams.size(); ++i) { | 1337 for (size_t i = 0; i < params_.ss.streams.size(); ++i) { |
| 1318 video_encoder_config_.max_bitrate_bps += | 1338 video_encoder_config_.max_bitrate_bps += |
| 1319 params_.ss.streams[i].max_bitrate_bps; | 1339 params_.ss.streams[i].max_bitrate_bps; |
| 1320 } | 1340 } |
| 1321 video_encoder_config_.video_stream_factory = | 1341 if (params_.ss.infer_streams) { |
| 1322 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); | 1342 video_encoder_config_.video_stream_factory = |
| 1343 new rtc::RefCountedObject<cricket::EncoderStreamFactory>( | |
| 1344 params_.video.codec, params_.ss.streams[0].max_qp, | |
| 1345 params_.video.fps, params_.screenshare.enabled, true); | |
| 1346 } else { | |
| 1347 video_encoder_config_.video_stream_factory = | |
| 1348 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); | |
| 1349 } | |
| 1323 | 1350 |
| 1324 video_encoder_config_.spatial_layers = params_.ss.spatial_layers; | 1351 video_encoder_config_.spatial_layers = params_.ss.spatial_layers; |
| 1325 | 1352 |
| 1326 CreateMatchingReceiveConfigs(recv_transport); | 1353 CreateMatchingReceiveConfigs(recv_transport); |
| 1327 | 1354 |
| 1328 for (size_t i = 0; i < num_video_streams; ++i) { | 1355 for (size_t i = 0; i < num_video_streams; ++i) { |
| 1329 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1356 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 1330 video_receive_configs_[i].rtp.rtx_ssrc = kSendRtxSsrcs[i]; | 1357 video_receive_configs_[i].rtp.rtx_ssrc = kSendRtxSsrcs[i]; |
| 1331 video_receive_configs_[i].rtp.rtx_payload_types[payload_type] = | 1358 video_receive_configs_[i].rtp.rtx_payload_types[payload_type] = |
| 1332 kSendRtxPayloadType; | 1359 kSendRtxPayloadType; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1415 thumbnail_send_config.rtp.extensions.push_back(RtpExtension( | 1442 thumbnail_send_config.rtp.extensions.push_back(RtpExtension( |
| 1416 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); | 1443 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); |
| 1417 } | 1444 } |
| 1418 | 1445 |
| 1419 VideoEncoderConfig thumbnail_encoder_config; | 1446 VideoEncoderConfig thumbnail_encoder_config; |
| 1420 thumbnail_encoder_config.min_transmit_bitrate_bps = 7500; | 1447 thumbnail_encoder_config.min_transmit_bitrate_bps = 7500; |
| 1421 thumbnail_send_config.suspend_below_min_bitrate = | 1448 thumbnail_send_config.suspend_below_min_bitrate = |
| 1422 params_.video.suspend_below_min_bitrate; | 1449 params_.video.suspend_below_min_bitrate; |
| 1423 thumbnail_encoder_config.number_of_streams = 1; | 1450 thumbnail_encoder_config.number_of_streams = 1; |
| 1424 thumbnail_encoder_config.max_bitrate_bps = 50000; | 1451 thumbnail_encoder_config.max_bitrate_bps = 50000; |
| 1425 thumbnail_encoder_config.video_stream_factory = | 1452 if (params_.ss.infer_streams) { |
| 1426 new rtc::RefCountedObject<VideoStreamFactory>( | 1453 thumbnail_encoder_config.video_stream_factory = |
| 1427 std::vector<webrtc::VideoStream>{DefaultThumbnailStream()}); | 1454 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); |
| 1455 } else { | |
| 1456 thumbnail_encoder_config.video_stream_factory = | |
| 1457 new rtc::RefCountedObject<cricket::EncoderStreamFactory>( | |
| 1458 params_.video.codec, params_.ss.streams[0].max_qp, | |
| 1459 params_.video.fps, params_.screenshare.enabled, true); | |
| 1460 } | |
| 1428 thumbnail_encoder_config.spatial_layers = params_.ss.spatial_layers; | 1461 thumbnail_encoder_config.spatial_layers = params_.ss.spatial_layers; |
| 1429 | 1462 |
| 1430 VideoReceiveStream::Config thumbnail_receive_config(send_transport); | 1463 VideoReceiveStream::Config thumbnail_receive_config(send_transport); |
| 1431 thumbnail_receive_config.rtp.remb = false; | 1464 thumbnail_receive_config.rtp.remb = false; |
| 1432 thumbnail_receive_config.rtp.transport_cc = true; | 1465 thumbnail_receive_config.rtp.transport_cc = true; |
| 1433 thumbnail_receive_config.rtp.local_ssrc = kReceiverLocalVideoSsrc; | 1466 thumbnail_receive_config.rtp.local_ssrc = kReceiverLocalVideoSsrc; |
| 1434 for (const RtpExtension& extension : thumbnail_send_config.rtp.extensions) | 1467 for (const RtpExtension& extension : thumbnail_send_config.rtp.extensions) |
| 1435 thumbnail_receive_config.rtp.extensions.push_back(extension); | 1468 thumbnail_receive_config.rtp.extensions.push_back(extension); |
| 1436 thumbnail_receive_config.renderer = &fake_renderer_; | 1469 thumbnail_receive_config.renderer = &fake_renderer_; |
| 1437 | 1470 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1557 } | 1590 } |
| 1558 | 1591 |
| 1559 void VideoQualityTest::CreateCapturer() { | 1592 void VideoQualityTest::CreateCapturer() { |
| 1560 if (params_.screenshare.enabled) { | 1593 if (params_.screenshare.enabled) { |
| 1561 test::FrameGeneratorCapturer* frame_generator_capturer = | 1594 test::FrameGeneratorCapturer* frame_generator_capturer = |
| 1562 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), | 1595 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), |
| 1563 params_.video.fps); | 1596 params_.video.fps); |
| 1564 EXPECT_TRUE(frame_generator_capturer->Init()); | 1597 EXPECT_TRUE(frame_generator_capturer->Init()); |
| 1565 video_capturer_.reset(frame_generator_capturer); | 1598 video_capturer_.reset(frame_generator_capturer); |
| 1566 } else { | 1599 } else { |
| 1567 if (params_.video.clip_name.empty()) { | 1600 if (params_.video.clip_name == "Generator") { |
| 1601 video_capturer_.reset(test::FrameGeneratorCapturer::Create( | |
| 1602 static_cast<int>(params_.video.width), | |
| 1603 static_cast<int>(params_.video.height), params_.video.fps, clock_)); | |
| 1604 } else if (params_.video.clip_name.empty()) { | |
| 1568 video_capturer_.reset(test::VcmCapturer::Create( | 1605 video_capturer_.reset(test::VcmCapturer::Create( |
| 1569 params_.video.width, params_.video.height, params_.video.fps, | 1606 params_.video.width, params_.video.height, params_.video.fps, |
| 1570 params_.video.capture_device_index)); | 1607 params_.video.capture_device_index)); |
| 1571 if (!video_capturer_) { | 1608 if (!video_capturer_) { |
| 1572 // Failed to get actual camera, use chroma generator as backup. | 1609 // Failed to get actual camera, use chroma generator as backup. |
| 1573 video_capturer_.reset(test::FrameGeneratorCapturer::Create( | 1610 video_capturer_.reset(test::FrameGeneratorCapturer::Create( |
| 1574 static_cast<int>(params_.video.width), | 1611 static_cast<int>(params_.video.width), |
| 1575 static_cast<int>(params_.video.height), params_.video.fps, clock_)); | 1612 static_cast<int>(params_.video.height), params_.video.fps, clock_)); |
| 1576 } | 1613 } |
| 1577 } else { | 1614 } else { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1654 degradation_preference_); | 1691 degradation_preference_); |
| 1655 | 1692 |
| 1656 SetupThumbnailCapturers(params_.num_thumbnails); | 1693 SetupThumbnailCapturers(params_.num_thumbnails); |
| 1657 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) { | 1694 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) { |
| 1658 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(), | 1695 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(), |
| 1659 degradation_preference_); | 1696 degradation_preference_); |
| 1660 } | 1697 } |
| 1661 | 1698 |
| 1662 CreateCapturer(); | 1699 CreateCapturer(); |
| 1663 | 1700 |
| 1664 rtc::VideoSinkWants wants; | 1701 analyzer.SetSource(video_capturer_.get(), params_.ss.infer_streams); |
| 1665 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); | |
| 1666 | 1702 |
| 1667 StartEncodedFrameLogs(video_send_stream_); | 1703 StartEncodedFrameLogs(video_send_stream_); |
| 1668 StartEncodedFrameLogs(video_receive_streams_[0]); | 1704 StartEncodedFrameLogs(video_receive_streams_[0]); |
| 1669 video_send_stream_->Start(); | 1705 video_send_stream_->Start(); |
| 1670 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) | 1706 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) |
| 1671 thumbnail_send_stream->Start(); | 1707 thumbnail_send_stream->Start(); |
| 1672 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1708 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
| 1673 receive_stream->Start(); | 1709 receive_stream->Start(); |
| 1674 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) | 1710 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) |
| 1675 receive_stream->Start(); | 1711 receive_stream->Start(); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1909 if (!params_.video.encoded_frame_base_path.empty()) { | 1945 if (!params_.video.encoded_frame_base_path.empty()) { |
| 1910 std::ostringstream str; | 1946 std::ostringstream str; |
| 1911 str << receive_logs_++; | 1947 str << receive_logs_++; |
| 1912 std::string path = | 1948 std::string path = |
| 1913 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1949 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1914 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1950 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1915 10000000); | 1951 10000000); |
| 1916 } | 1952 } |
| 1917 } | 1953 } |
| 1918 } // namespace webrtc | 1954 } // namespace webrtc |
| OLD | NEW |