summaryrefslogtreecommitdiffstats
path: root/remoting/client/plugin
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2015-10-01 11:40:48 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-01 18:42:40 +0000
commit8acf48f8eee79de78c4d6aac59ba3ef06daa8918 (patch)
tree634a10a77f8d96925bcb6180a797d762ecd26980 /remoting/client/plugin
parent5f1f3a71c26c8fc00ce47d84328851082fef14c0 (diff)
downloadchromium_src-8acf48f8eee79de78c4d6aac59ba3ef06daa8918.zip
chromium_src-8acf48f8eee79de78c4d6aac59ba3ef06daa8918.tar.gz
chromium_src-8acf48f8eee79de78c4d6aac59ba3ef06daa8918.tar.bz2
Improve roundtrip stats calculation in the client
Previously decode and rendering time wasn't include the total roundtrip estimation, which is fixed now. Also moved latency calculation logic to PerformanceTracker, which allowed to simplify rendering code. Review URL: https://codereview.chromium.org/1382523002 Cr-Commit-Position: refs/heads/master@{#351850}
Diffstat (limited to 'remoting/client/plugin')
-rw-r--r--remoting/client/plugin/pepper_video_renderer_3d.cc32
-rw-r--r--remoting/client/plugin/pepper_video_renderer_3d.h16
2 files changed, 3 insertions, 45 deletions
diff --git a/remoting/client/plugin/pepper_video_renderer_3d.cc b/remoting/client/plugin/pepper_video_renderer_3d.cc
index 83985d4..4d518b6 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.cc
+++ b/remoting/client/plugin/pepper_video_renderer_3d.cc
@@ -54,11 +54,6 @@ class PepperVideoRenderer3D::Picture {
PP_VideoPicture picture_;
};
-PepperVideoRenderer3D::FrameDecodeTimestamp::FrameDecodeTimestamp(
- uint32_t frame_id,
- base::TimeTicks decode_started_time)
- : frame_id(frame_id), decode_started_time(decode_started_time) {}
-
PepperVideoRenderer3D::PepperVideoRenderer3D() : callback_factory_(this) {}
PepperVideoRenderer3D::~PepperVideoRenderer3D() {
@@ -265,14 +260,10 @@ void PepperVideoRenderer3D::DecodeNextPacket() {
if (!initialization_finished_ || decode_pending_ || pending_packets_.empty())
return;
- ++latest_frame_id_;
- frame_decode_timestamps_.push_back(
- FrameDecodeTimestamp(latest_frame_id_, base::TimeTicks::Now()));
-
const VideoPacket* packet = pending_packets_.front()->packet();
int32_t result = video_decoder_.Decode(
- latest_frame_id_, packet->data().size(), packet->data().data(),
+ packet->frame_id(), packet->data().size(), packet->data().data(),
callback_factory_.NewCallback(&PepperVideoRenderer3D::OnDecodeDone));
CHECK_EQ(result, PP_OK_COMPLETIONPENDING);
decode_pending_ = true;
@@ -317,21 +308,7 @@ void PepperVideoRenderer3D::OnPictureReady(int32_t result,
return;
}
- CHECK(!frame_decode_timestamps_.empty());
- const FrameDecodeTimestamp& frame_timer = frame_decode_timestamps_.front();
-
- if (picture.decode_id != frame_timer.frame_id) {
- LOG(ERROR)
- << "Received a video packet that didn't contain a complete frame.";
- event_handler_->OnVideoDecodeError();
- return;
- }
-
- base::TimeDelta decode_time =
- base::TimeTicks::Now() - frame_timer.decode_started_time;
- perf_tracker_->RecordDecodeTime(decode_time.InMilliseconds());
-
- frame_decode_timestamps_.pop_front();
+ perf_tracker_->OnFrameDecoded(picture.decode_id);
next_picture_.reset(new Picture(&video_decoder_, picture));
@@ -348,7 +325,6 @@ void PepperVideoRenderer3D::PaintIfNeeded() {
current_picture_ = next_picture_.Pass();
force_repaint_ = false;
- latest_paint_started_time_ = base::TimeTicks::Now();
const PP_VideoPicture& picture = current_picture_->picture();
PP_Resource graphics_3d = graphics_.pp_resource();
@@ -409,9 +385,7 @@ void PepperVideoRenderer3D::OnPaintDone(int32_t result) {
CHECK_EQ(result, PP_OK) << "Graphics3D::SwapBuffers() failed";
paint_pending_ = false;
- base::TimeDelta paint_time =
- base::TimeTicks::Now() - latest_paint_started_time_;
- perf_tracker_->RecordPaintTime(paint_time.InMilliseconds());
+ perf_tracker_->OnFramePainted(current_picture_->picture().decode_id);
PaintIfNeeded();
}
diff --git a/remoting/client/plugin/pepper_video_renderer_3d.h b/remoting/client/plugin/pepper_video_renderer_3d.h
index a624a87..2c229b6 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.h
+++ b/remoting/client/plugin/pepper_video_renderer_3d.h
@@ -11,7 +11,6 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "base/time/time.h"
#include "ppapi/cpp/graphics_3d.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/video_decoder.h"
@@ -53,13 +52,6 @@ class PepperVideoRenderer3D : public PepperVideoRenderer,
class PendingPacket;
class Picture;
- struct FrameDecodeTimestamp {
- FrameDecodeTimestamp(uint32_t frame_id,
- base::TimeTicks decode_started_time);
- uint32_t frame_id;
- base::TimeTicks decode_started_time;
- };
-
// Callback for pp::VideoDecoder::Initialize().
void OnInitialized(int32_t result);
@@ -113,15 +105,10 @@ class PepperVideoRenderer3D : public PepperVideoRenderer,
bool get_picture_pending_ = false;
bool paint_pending_ = false;
- uint32_t latest_frame_id_ = 0;
-
// Queue of packets that that have been received, but haven't been passed to
// the decoder yet.
std::deque<PendingPacket*> pending_packets_;
- // Timestamps for all frames currently being processed by the decoder.
- std::deque<FrameDecodeTimestamp> frame_decode_timestamps_;
-
// The current picture shown on the screen or being rendered. Must be deleted
// before |video_decoder_|.
scoped_ptr<Picture> current_picture_;
@@ -134,9 +121,6 @@ class PepperVideoRenderer3D : public PepperVideoRenderer,
// Set to true if the screen has been resized and needs to be repainted.
bool force_repaint_ = false;
- // Time the last paint operation was started.
- base::TimeTicks latest_paint_started_time_;
-
// The texture type for which |shader_program| was initialized. Can be either
// 0, GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB or GL_TEXTURE_EXTERNAL_OES. 0
// indicates that |shader_program_| hasn't been intialized.