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

Unified Diff: remoting/protocol/webrtc_video_stream.cc

Issue 2779483002: Revert of [Chromoting] Send DesktopFrame::capturer_id() to client through WebrtcVideoStream (Closed)
Patch Set: Created 3 years, 9 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_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_video_stream.cc
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc
index 04a8aba6b30cb541a83deab26aab870a923826af..8c2478bf7b1fd0ce525d646143071d111bd8f423 100644
--- a/remoting/protocol/webrtc_video_stream.cc
+++ b/remoting/protocol/webrtc_video_stream.cc
@@ -26,7 +26,7 @@
const char kStreamLabel[] = "screen_stream";
const char kVideoLabel[] = "screen_video";
-struct WebrtcVideoStream::FrameStats {
+struct WebrtcVideoStream::FrameTimestamps {
// The following fields is not null only for one frame after each incoming
// input event.
InputEventTimestamps input_event_timestamps;
@@ -36,13 +36,11 @@
base::TimeDelta capture_delay;
base::TimeTicks encode_started_time;
base::TimeTicks encode_ended_time;
-
- uint32_t capturer_id = 0;
};
-struct WebrtcVideoStream::EncodedFrameWithStats {
+struct WebrtcVideoStream::EncodedFrameWithTimestamps {
std::unique_ptr<WebrtcVideoEncoder::EncodedFrame> frame;
- std::unique_ptr<FrameStats> stats;
+ std::unique_ptr<FrameTimestamps> timestamps;
};
WebrtcVideoStream::WebrtcVideoStream()
@@ -141,8 +139,8 @@
std::unique_ptr<webrtc::DesktopFrame> frame) {
DCHECK(thread_checker_.CalledOnValidThread());
- captured_frame_stats_->capture_ended_time = base::TimeTicks::Now();
- captured_frame_stats_->capture_delay =
+ captured_frame_timestamps_->capture_ended_time = base::TimeTicks::Now();
+ captured_frame_timestamps_->capture_delay =
base::TimeDelta::FromMilliseconds(frame ? frame->capture_time_ms() : 0);
WebrtcVideoEncoder::FrameParams frame_params;
@@ -168,7 +166,7 @@
encode_task_runner_.get(), FROM_HERE,
base::Bind(&WebrtcVideoStream::EncodeFrame, encoder_.get(),
base::Passed(std::move(frame)), frame_params,
- base::Passed(std::move(captured_frame_stats_))),
+ base::Passed(std::move(captured_frame_timestamps_))),
base::Bind(&WebrtcVideoStream::OnFrameEncoded,
weak_factory_.GetWeakPtr()));
}
@@ -186,30 +184,29 @@
void WebrtcVideoStream::CaptureNextFrame() {
DCHECK(thread_checker_.CalledOnValidThread());
- captured_frame_stats_.reset(new FrameStats());
- captured_frame_stats_->capture_started_time = base::TimeTicks::Now();
- captured_frame_stats_->input_event_timestamps =
+ captured_frame_timestamps_.reset(new FrameTimestamps());
+ captured_frame_timestamps_->capture_started_time = base::TimeTicks::Now();
+ captured_frame_timestamps_->input_event_timestamps =
event_timestamps_source_->TakeLastEventTimestamps();
capturer_->CaptureFrame();
}
// static
-WebrtcVideoStream::EncodedFrameWithStats WebrtcVideoStream::EncodeFrame(
+WebrtcVideoStream::EncodedFrameWithTimestamps WebrtcVideoStream::EncodeFrame(
WebrtcVideoEncoder* encoder,
std::unique_ptr<webrtc::DesktopFrame> frame,
WebrtcVideoEncoder::FrameParams params,
- std::unique_ptr<WebrtcVideoStream::FrameStats> stats) {
- EncodedFrameWithStats result;
- result.stats = std::move(stats);
- result.stats->encode_started_time = base::TimeTicks::Now();
+ std::unique_ptr<WebrtcVideoStream::FrameTimestamps> timestamps) {
+ EncodedFrameWithTimestamps result;
+ result.timestamps = std::move(timestamps);
+ result.timestamps->encode_started_time = base::TimeTicks::Now();
result.frame = encoder->Encode(frame.get(), params);
- result.stats->encode_ended_time = base::TimeTicks::Now();
- result.stats->capturer_id = frame->capturer_id();
+ result.timestamps->encode_ended_time = base::TimeTicks::Now();
return result;
}
-void WebrtcVideoStream::OnFrameEncoded(EncodedFrameWithStats frame) {
+void WebrtcVideoStream::OnFrameEncoded(EncodedFrameWithTimestamps frame) {
DCHECK(thread_checker_.CalledOnValidThread());
HostFrameStats stats;
@@ -221,7 +218,7 @@
webrtc::EncodedImageCallback::Result result =
webrtc_transport_->video_encoder_factory()->SendEncodedFrame(
- *frame.frame, frame.stats->capture_started_time);
+ *frame.frame, frame.timestamps->capture_started_time);
if (result.error != webrtc::EncodedImageCallback::Result::OK) {
// TODO(sergeyu): Stop the stream.
LOG(ERROR) << "Failed to send video frame.";
@@ -232,28 +229,26 @@
if (video_stats_dispatcher_.is_connected()) {
stats.frame_size = frame.frame ? frame.frame->data.size() : 0;
- if (!frame.stats->input_event_timestamps.is_null()) {
+ if (!frame.timestamps->input_event_timestamps.is_null()) {
stats.capture_pending_delay =
- frame.stats->capture_started_time -
- frame.stats->input_event_timestamps.host_timestamp;
+ frame.timestamps->capture_started_time -
+ frame.timestamps->input_event_timestamps.host_timestamp;
stats.latest_event_timestamp =
- frame.stats->input_event_timestamps.client_timestamp;
+ frame.timestamps->input_event_timestamps.client_timestamp;
}
- stats.capture_delay = frame.stats->capture_delay;
+ stats.capture_delay = frame.timestamps->capture_delay;
// Total overhead time for IPC and threading when capturing frames.
- stats.capture_overhead_delay = (frame.stats->capture_ended_time -
- frame.stats->capture_started_time) -
+ stats.capture_overhead_delay = (frame.timestamps->capture_ended_time -
+ frame.timestamps->capture_started_time) -
stats.capture_delay;
- stats.encode_pending_delay = frame.stats->encode_started_time -
- frame.stats->capture_ended_time;
-
- stats.encode_delay = frame.stats->encode_ended_time -
- frame.stats->encode_started_time;
-
- stats.capturer_id = frame.stats->capturer_id;
+ stats.encode_pending_delay = frame.timestamps->encode_started_time -
+ frame.timestamps->capture_ended_time;
+
+ stats.encode_delay = frame.timestamps->encode_ended_time -
+ frame.timestamps->encode_started_time;
video_stats_dispatcher_.OnVideoFrameStats(result.frame_id, stats);
}
« no previous file with comments | « remoting/protocol/webrtc_video_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698