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

Unified Diff: remoting/protocol/webrtc_video_renderer_adapter.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/protocol/webrtc_video_renderer_adapter.h ('k') | remoting/remoting_srcs.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_video_renderer_adapter.cc
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.cc b/remoting/protocol/webrtc_video_renderer_adapter.cc
index ed16463b04519db16314ffeec74722b781cc1020..e8697cf03fa6b8ea96c9d8a2c3813aca95e14bc7 100644
--- a/remoting/protocol/webrtc_video_renderer_adapter.cc
+++ b/remoting/protocol/webrtc_video_renderer_adapter.cc
@@ -16,6 +16,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
#include "remoting/protocol/frame_consumer.h"
+#include "remoting/protocol/frame_stats.h"
#include "third_party/libyuv/include/libyuv/convert_argb.h"
#include "third_party/libyuv/include/libyuv/video_common.h"
#include "third_party/webrtc/media/base/videoframe.h"
@@ -84,15 +85,21 @@ void WebrtcVideoRendererAdapter::OnFrame(const cricket::VideoFrame& frame) {
LOG(WARNING) << "Received frame with playout delay greater than 0.";
}
+ std::unique_ptr<FrameStats> stats(new FrameStats());
+ // TODO(sergeyu): |time_received| is not reported correctly here because the
+ // frame is already decoded at this point.
+ stats->time_received = base::TimeTicks::Now();
+
task_runner_->PostTask(
FROM_HERE,
base::Bind(&WebrtcVideoRendererAdapter::HandleFrameOnMainThread,
- weak_factory_.GetWeakPtr(),
+ weak_factory_.GetWeakPtr(), base::Passed(&stats),
scoped_refptr<webrtc::VideoFrameBuffer>(
frame.video_frame_buffer().get())));
}
void WebrtcVideoRendererAdapter::HandleFrameOnMainThread(
+ std::unique_ptr<FrameStats> stats,
scoped_refptr<webrtc::VideoFrameBuffer> frame) {
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -105,13 +112,23 @@ void WebrtcVideoRendererAdapter::HandleFrameOnMainThread(
base::Bind(&ConvertYuvToRgb, base::Passed(&frame),
base::Passed(&rgb_frame), output_format_fourcc_),
base::Bind(&WebrtcVideoRendererAdapter::DrawFrame,
- weak_factory_.GetWeakPtr()));
+ weak_factory_.GetWeakPtr(), base::Passed(&stats)));
}
void WebrtcVideoRendererAdapter::DrawFrame(
+ std::unique_ptr<FrameStats> stats,
std::unique_ptr<webrtc::DesktopFrame> frame) {
DCHECK(task_runner_->BelongsToCurrentThread());
- frame_consumer_->DrawFrame(std::move(frame), base::Closure());
+ stats->time_decoded = base::TimeTicks::Now();
+ frame_consumer_->DrawFrame(
+ std::move(frame),
+ base::Bind(&WebrtcVideoRendererAdapter::FrameRendered,
+ weak_factory_.GetWeakPtr(), base::Passed(&stats)));
+}
+
+void WebrtcVideoRendererAdapter::FrameRendered(
+ std::unique_ptr<FrameStats> stats) {
+ // TODO(sergeyu): Report stats here
}
} // namespace protocol
« no previous file with comments | « remoting/protocol/webrtc_video_renderer_adapter.h ('k') | remoting/remoting_srcs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698