Chromium Code Reviews| Index: webrtc/video/video_quality_test.cc |
| diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc |
| index a94cb4642fb1a199aa5abf74fc117350ea0ac9b6..e4db5e79a4b474f2c7ea557f9c9ae01728315178 100644 |
| --- a/webrtc/video/video_quality_test.cc |
| +++ b/webrtc/video/video_quality_test.cc |
| @@ -43,7 +43,6 @@ static const int kPayloadTypeVP9 = 124; |
| class VideoAnalyzer : public PacketReceiver, |
| public Transport, |
| public VideoRenderer, |
| - public VideoCaptureInput, |
| public EncodedFrameObserver, |
| public EncodingTimeObserver { |
| public: |
| @@ -55,8 +54,7 @@ class VideoAnalyzer : public PacketReceiver, |
| FILE* graph_data_output_file, |
| const std::string& graph_title, |
| uint32_t ssrc_to_analyze) |
| - : input_(nullptr), |
| - transport_(transport), |
| + : transport_(transport), |
| receiver_(nullptr), |
| send_stream_(nullptr), |
| test_label_(test_label), |
| @@ -132,21 +130,6 @@ class VideoAnalyzer : public PacketReceiver, |
| samples_encode_time_ms_[ntp_time_ms] = encode_time_ms; |
| } |
| - void IncomingCapturedFrame(const VideoFrame& video_frame) override { |
| - VideoFrame copy = video_frame; |
| - copy.set_timestamp(copy.ntp_time_ms() * 90); |
| - |
| - { |
| - rtc::CritScope lock(&crit_); |
| - if (first_send_frame_.IsZeroSize() && rtp_timestamp_delta_ == 0) |
| - first_send_frame_ = copy; |
| - |
| - frames_.push_back(copy); |
| - } |
| - |
| - input_->IncomingCapturedFrame(video_frame); |
| - } |
| - |
| bool SendRtp(const uint8_t* packet, |
| size_t length, |
| const PacketOptions& options) override { |
| @@ -186,12 +169,22 @@ class VideoAnalyzer : public PacketReceiver, |
| void RenderFrame(const VideoFrame& video_frame, |
|
pbos-webrtc
2015/12/19 11:02:34
Put a comment on this function to document that th
|
| int time_to_render_ms) override { |
| + rtc::CritScope lock(&crit_); |
| + uint32_t last_timestamp = |
| + frames_.empty() ? 0 : frames_.rbegin()->timestamp(); |
| + if (video_frame.timestamp() > last_timestamp) { |
| + // This is must be an input frame, just add a copy to frames_ and return. |
| + if (first_send_frame_.IsZeroSize() && rtp_timestamp_delta_ == 0) |
| + first_send_frame_ = video_frame; |
| + |
| + frames_.push_back(video_frame); |
| + return; |
| + } |
| + |
| int64_t render_time_ms = |
| Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
| uint32_t send_timestamp = video_frame.timestamp() - rtp_timestamp_delta_; |
| - rtc::CritScope lock(&crit_); |
| - |
| while (frames_.front().timestamp() < send_timestamp) { |
| AddFrameComparison(frames_.front(), last_rendered_frame_, true, |
| render_time_ms); |
| @@ -258,7 +251,6 @@ class VideoAnalyzer : public PacketReceiver, |
| stats_polling_thread_.Stop(); |
| } |
| - VideoCaptureInput* input_; |
| test::LayerFilteringTransport* const transport_; |
| PacketReceiver* receiver_; |
| VideoSendStream* send_stream_; |
| @@ -970,6 +962,7 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) { |
| SetupCommon(&analyzer, &recv_transport); |
| send_config_.encoding_time_observer = &analyzer; |
| + send_config_.local_renderer = &analyzer; |
| receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
| for (auto& config : receive_configs_) |
| config.pre_decode_callback = &analyzer; |
| @@ -978,10 +971,9 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) { |
| SetupScreenshare(); |
| CreateStreams(); |
| - analyzer.input_ = send_stream_->Input(); |
| analyzer.send_stream_ = send_stream_; |
| - CreateCapturer(&analyzer); |
| + CreateCapturer(send_stream_->Input()); |
| send_stream_->Start(); |
| for (size_t i = 0; i < receive_streams_.size(); ++i) |