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

Unified Diff: remoting/host/screen_recorder.cc

Issue 9827006: Refactor VideoStub interface to accept ownership of video packets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/host/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/screen_recorder.cc
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc
index 96897a34fb64090d6b5eb81d44021c62d798186b..3804b76c4f7dd0ef9472859b83a4c754c1860796 100644
--- a/remoting/host/screen_recorder.cc
+++ b/remoting/host/screen_recorder.cc
@@ -240,26 +240,24 @@ void ScreenRecorder::DoSendVideoPacket(scoped_ptr<VideoPacket> packet) {
if (network_stopped_ || connections_.empty())
return;
- VideoPacket* packet_ptr = packet.get();
+ base::Closure callback;
+ if ((packet->flags() & VideoPacket::LAST_PARTITION) != 0)
+ callback = base::Bind(&ScreenRecorder::VideoFrameSentCallback, this);
// TODO(sergeyu): Currently we send the data only to the first
// connection. Send it to all connections if necessary.
connections_.front()->video_stub()->ProcessVideoPacket(
- packet_ptr, base::Bind(
- &ScreenRecorder::VideoPacketSentCallback, this,
- base::Passed(packet.Pass())));
+ packet.Pass(), callback);
}
-void ScreenRecorder::VideoPacketSentCallback(scoped_ptr<VideoPacket> packet) {
+void ScreenRecorder::VideoFrameSentCallback() {
+ DCHECK(network_loop_->BelongsToCurrentThread());
+
if (network_stopped_)
return;
- if ((packet->flags() & VideoPacket::LAST_PARTITION) != 0) {
- // Post DoFinishOneRecording() if that was the last packet for the
- // frame.
- capture_loop_->PostTask(
- FROM_HERE, base::Bind(&ScreenRecorder::DoFinishOneRecording, this));
- }
+ capture_loop_->PostTask(
+ FROM_HERE, base::Bind(&ScreenRecorder::DoFinishOneRecording, this));
}
void ScreenRecorder::DoStopOnNetworkThread(const base::Closure& done_task) {
« no previous file with comments | « remoting/host/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698