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

Side by Side Diff: webrtc/video/video_receive_stream.cc

Issue 1340623002: Add stats for average QP per frame for VP8 (for received video streams). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 <string> 15 #include <string>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
19 #include "webrtc/system_wrappers/interface/clock.h" 19 #include "webrtc/system_wrappers/interface/clock.h"
20 #include "webrtc/system_wrappers/interface/logging.h" 20 #include "webrtc/system_wrappers/interface/logging.h"
21 #include "webrtc/video/receive_statistics_proxy.h" 21 #include "webrtc/video/receive_statistics_proxy.h"
22 #include "webrtc/video_encoder.h"
23 #include "webrtc/video_engine/call_stats.h" 22 #include "webrtc/video_engine/call_stats.h"
24 #include "webrtc/video_receive_stream.h" 23 #include "webrtc/video_receive_stream.h"
25 24
26 namespace webrtc { 25 namespace webrtc {
27 26
28 static bool UseSendSideBwe(const std::vector<RtpExtension>& extensions) { 27 static bool UseSendSideBwe(const std::vector<RtpExtension>& extensions) {
29 for (const auto& extension : extensions) { 28 for (const auto& extension : extensions) {
30 if (extension.name == RtpExtension::kTransportSequenceNumber) 29 if (extension.name == RtpExtension::kTransportSequenceNumber)
31 return true; 30 return true;
32 } 31 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 nullptr, bitrate_estimator, 161 nullptr, bitrate_estimator,
163 channel_group_->GetCallStats()->rtcp_rtt_stats(), channel_group_->pacer(), 162 channel_group_->GetCallStats()->rtcp_rtt_stats(), channel_group_->pacer(),
164 channel_group_->packet_router(), 1, false)); 163 channel_group_->packet_router(), 1, false));
165 164
166 RTC_CHECK(vie_channel_->Init() == 0); 165 RTC_CHECK(vie_channel_->Init() == 0);
167 166
168 // Register the channel to receive stats updates. 167 // Register the channel to receive stats updates.
169 channel_group_->GetCallStats()->RegisterStatsObserver( 168 channel_group_->GetCallStats()->RegisterStatsObserver(
170 vie_channel_->GetStatsObserver()); 169 vie_channel_->GetStatsObserver());
171 170
172
173 // TODO(pbos): This is not fine grained enough... 171 // TODO(pbos): This is not fine grained enough...
174 vie_channel_->SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, 172 vie_channel_->SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false,
175 -1, -1); 173 -1, -1);
176 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) 174 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff)
177 << "A stream should not be configured with RTCP disabled. This value is " 175 << "A stream should not be configured with RTCP disabled. This value is "
178 "reserved for internal usage."; 176 "reserved for internal usage.";
179 vie_channel_->SetRTCPMode(config_.rtp.rtcp_mode); 177 vie_channel_->SetRTCPMode(config_.rtp.rtcp_mode);
180 178
181 RTC_DCHECK(config_.rtp.remote_ssrc != 0); 179 RTC_DCHECK(config_.rtp.remote_ssrc != 0);
182 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams? 180 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams?
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 VideoCodec codec = CreateDecoderVideoCodec(decoder); 269 VideoCodec codec = CreateDecoderVideoCodec(decoder);
272 270
273 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec)); 271 RTC_CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec));
274 } 272 }
275 273
276 incoming_video_stream_.reset(new IncomingVideoStream(0)); 274 incoming_video_stream_.reset(new IncomingVideoStream(0));
277 incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms); 275 incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms);
278 incoming_video_stream_->SetExternalCallback(this); 276 incoming_video_stream_->SetExternalCallback(this);
279 vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get()); 277 vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get());
280 278
281 if (config.pre_decode_callback) 279 vie_channel_->RegisterPreDecodeImageCallback(this);
282 vie_channel_->RegisterPreDecodeImageCallback(&encoded_frame_proxy_);
283 vie_channel_->RegisterPreRenderCallback(this); 280 vie_channel_->RegisterPreRenderCallback(this);
284 } 281 }
285 282
286 VideoReceiveStream::~VideoReceiveStream() { 283 VideoReceiveStream::~VideoReceiveStream() {
287 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); 284 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString();
288 incoming_video_stream_->Stop(); 285 incoming_video_stream_->Stop();
289 vie_channel_->RegisterPreRenderCallback(nullptr); 286 vie_channel_->RegisterPreRenderCallback(nullptr);
290 vie_channel_->RegisterPreDecodeImageCallback(nullptr); 287 vie_channel_->RegisterPreDecodeImageCallback(nullptr);
291 288
292 for (size_t i = 0; i < config_.decoders.size(); ++i) 289 for (size_t i = 0; i < config_.decoders.size(); ++i)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 if (config_.renderer != nullptr) 355 if (config_.renderer != nullptr)
359 config_.renderer->RenderFrame( 356 config_.renderer->RenderFrame(
360 video_frame, 357 video_frame,
361 video_frame.render_time_ms() - clock_->TimeInMilliseconds()); 358 video_frame.render_time_ms() - clock_->TimeInMilliseconds());
362 359
363 stats_proxy_->OnRenderedFrame(video_frame.width(), video_frame.height()); 360 stats_proxy_->OnRenderedFrame(video_frame.width(), video_frame.height());
364 361
365 return 0; 362 return 0;
366 } 363 }
367 364
365 // TODO(asapersson): Consider moving callback from video_encoder.h or
366 // creating a different callback.
367 int32_t VideoReceiveStream::Encoded(
368 const EncodedImage& encoded_image,
369 const CodecSpecificInfo* codec_specific_info,
370 const RTPFragmentationHeader* fragmentation) {
371 stats_proxy_->OnPreDecode(encoded_image, codec_specific_info);
372 if (config_.pre_decode_callback) {
373 // TODO(asapersson): Remove EncodedFrameCallbackAdapter.
374 encoded_frame_proxy_.Encoded(
375 encoded_image, codec_specific_info, fragmentation);
376 }
377 return 0;
378 }
379
368 void VideoReceiveStream::SignalNetworkState(NetworkState state) { 380 void VideoReceiveStream::SignalNetworkState(NetworkState state) {
369 vie_channel_->SetRTCPMode(state == kNetworkUp ? config_.rtp.rtcp_mode 381 vie_channel_->SetRTCPMode(state == kNetworkUp ? config_.rtp.rtcp_mode
370 : RtcpMode::kOff); 382 : RtcpMode::kOff);
371 } 383 }
372 384
373 } // namespace internal 385 } // namespace internal
374 } // namespace webrtc 386 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698