Replace VideoStream::SizeCallback with VideoStream::Observer interface.
The new Observer interface will allow to notify ClientSession when a
video frame is sent, which will allow to provide the client with the
frame_id->event_timestamp mapping.
BUG=621691
Review-Url: https://codereview.chromium.org/2083843002
Cr-Commit-Position: refs/heads/master@{#401214}
diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc
index e2882ad7..c68fff84 100644
--- a/remoting/protocol/video_frame_pump.cc
+++ b/remoting/protocol/video_frame_pump.cc
@@ -107,9 +107,9 @@
base::Unretained(encoder_.get()), want_lossless));
}
-void VideoFramePump::SetSizeCallback(const SizeCallback& size_callback) {
+void VideoFramePump::SetObserver(Observer* observer) {
DCHECK(thread_checker_.CalledOnValidThread());
- size_callback_ = size_callback;
+ observer_ = observer;
}
void VideoFramePump::OnCaptureResult(
@@ -128,8 +128,8 @@
if (!frame_size_.equals(frame->size()) || !frame_dpi_.equals(dpi)) {
frame_size_ = frame->size();
frame_dpi_ = dpi;
- if (!size_callback_.is_null())
- size_callback_.Run(frame_size_, frame_dpi_);
+ if (observer_)
+ observer_->OnVideoSizeChanged(this, frame_size_, frame_dpi_);
}
}
@@ -208,6 +208,12 @@
packet->timestamps->can_send_time = base::TimeTicks::Now();
UpdateFrameTimers(packet->packet.get(), packet->timestamps.get());
+ if (observer_) {
+ observer_->OnVideoFrameSent(
+ this, packet->packet->frame_id(),
+ packet->timestamps->input_event_client_timestamp);
+ }
+
send_pending_ = true;
video_stub_->ProcessVideoPacket(std::move(packet->packet),
base::Bind(&VideoFramePump::OnVideoPacketSent,