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

Unified Diff: remoting/client/software_video_renderer.cc

Issue 2096643003: Rework PerformanceTracker to make it usable with WebRTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address feedback Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/software_video_renderer.h ('k') | remoting/protocol/frame_stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/software_video_renderer.cc
diff --git a/remoting/client/software_video_renderer.cc b/remoting/client/software_video_renderer.cc
index 0bb2f03b5615a70bf5ac89a94fe0d7eb46172981..18b92d968d75b42d2f74819bbc5e074f1f305f78 100644
--- a/remoting/client/software_video_renderer.cc
+++ b/remoting/client/software_video_renderer.cc
@@ -20,6 +20,8 @@
#include "remoting/codec/video_decoder_vpx.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/frame_consumer.h"
+#include "remoting/protocol/frame_stats.h"
+#include "remoting/protocol/performance_tracker.h"
#include "remoting/protocol/session_config.h"
#include "third_party/libyuv/include/libyuv/convert_argb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
@@ -123,12 +125,15 @@ void SoftwareVideoRenderer::ProcessVideoPacket(
base::ScopedClosureRunner done_runner(done);
- if (perf_tracker_)
- perf_tracker_->RecordVideoPacketStats(*packet);
+ std::unique_ptr<protocol::FrameStats> frame_stats(new protocol::FrameStats(
+ protocol::FrameStats::GetForVideoPacket(*packet)));
- // If the video packet is empty then drop it. Empty packets are used to
- // maintain activity on the network.
+ // If the video packet is empty then there is nothing to decode. Empty packets
+ // are used to maintain activity on the network. Stats for such packets still
+ // need to be reported.
if (!packet->has_data() || packet->data().size() == 0) {
+ if (perf_tracker_)
+ perf_tracker_->RecordVideoFrameStats(*frame_stats);
return;
}
@@ -155,23 +160,22 @@ void SoftwareVideoRenderer::ProcessVideoPacket(
consumer_->AllocateFrame(source_size_);
frame->set_dpi(source_dpi_);
- int32_t frame_id = packet->frame_id();
base::PostTaskAndReplyWithResult(
decode_task_runner_.get(), FROM_HERE,
base::Bind(&DoDecodeFrame, decoder_.get(), base::Passed(&packet),
base::Passed(&frame)),
base::Bind(&SoftwareVideoRenderer::RenderFrame,
- weak_factory_.GetWeakPtr(), frame_id, done_runner.Release()));
+ weak_factory_.GetWeakPtr(), base::Passed(&frame_stats),
+ done_runner.Release()));
}
void SoftwareVideoRenderer::RenderFrame(
- int32_t frame_id,
+ std::unique_ptr<protocol::FrameStats> stats,
const base::Closure& done,
std::unique_ptr<webrtc::DesktopFrame> frame) {
DCHECK(thread_checker_.CalledOnValidThread());
- if (perf_tracker_)
- perf_tracker_->OnFrameDecoded(frame_id);
+ stats->time_decoded = base::TimeTicks::Now();
if (!frame) {
if (!done.is_null())
@@ -179,17 +183,20 @@ void SoftwareVideoRenderer::RenderFrame(
return;
}
- consumer_->DrawFrame(std::move(frame),
- base::Bind(&SoftwareVideoRenderer::OnFrameRendered,
- weak_factory_.GetWeakPtr(), frame_id, done));
+ consumer_->DrawFrame(
+ std::move(frame),
+ base::Bind(&SoftwareVideoRenderer::OnFrameRendered,
+ weak_factory_.GetWeakPtr(), base::Passed(&stats), done));
}
-void SoftwareVideoRenderer::OnFrameRendered(int32_t frame_id,
- const base::Closure& done) {
+void SoftwareVideoRenderer::OnFrameRendered(
+ std::unique_ptr<protocol::FrameStats> stats,
+ const base::Closure& done) {
DCHECK(thread_checker_.CalledOnValidThread());
+ stats->time_rendered = base::TimeTicks::Now();
if (perf_tracker_)
- perf_tracker_->OnFramePainted(frame_id);
+ perf_tracker_->RecordVideoFrameStats(*stats);
if (!done.is_null())
done.Run();
« no previous file with comments | « remoting/client/software_video_renderer.h ('k') | remoting/protocol/frame_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698