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

Unified Diff: remoting/host/screen_recorder.cc

Issue 10382184: [Chromoting] Initial plumbing for cursor shape. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment for CaptureCursor Created 8 years, 7 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
Index: remoting/host/screen_recorder.cc
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc
index ab96a53708cf35a6c6db14f1e7d1fea6ef8635ff..5e98ff1706877a9b7e69bf5cbc953cfffe2af90b 100644
--- a/remoting/host/screen_recorder.cc
+++ b/remoting/host/screen_recorder.cc
@@ -142,6 +142,9 @@ void ScreenRecorder::DoStart() {
return;
}
+ capturer()->SetCursorShapeChangedCallback(
+ base::Bind(&ScreenRecorder::CursorShapeChangedCallback, this));
Wez 2012/05/16 00:20:04 nit: Could we do this in the ScreenRecorder's cons
garykac 2012/05/22 00:42:03 Wrong thread.
+
capturer()->Start();
capture_timer_.reset(new base::OneShotTimer<ScreenRecorder>());
@@ -214,6 +217,18 @@ void ScreenRecorder::CaptureDoneCallback(
FROM_HERE, base::Bind(&ScreenRecorder::DoEncode, this, capture_data));
}
+void ScreenRecorder::CursorShapeChangedCallback(
+ scoped_refptr<CursorShapeData> cursor_data) {
+ DCHECK_EQ(capture_loop_, MessageLoop::current());
+
+ if (!is_recording())
+ return;
+
+ encode_loop_->PostTask(
+ FROM_HERE, base::Bind(&ScreenRecorder::DoEncodeCursor,
+ this, cursor_data));
+}
+
void ScreenRecorder::DoFinishOneRecording() {
DCHECK_EQ(capture_loop_, MessageLoop::current());
@@ -307,6 +322,36 @@ void ScreenRecorder::DoEncode(
base::Bind(&ScreenRecorder::EncodedDataAvailableCallback, this));
}
+void ScreenRecorder::DoEncodeCursor(scoped_refptr<CursorShapeData> cursor) {
+ DCHECK_EQ(encode_loop_, MessageLoop::current());
+
+ scoped_ptr<VideoPacket> packet(new VideoPacket());
+ packet->set_flags(VideoPacket::CURSOR_SHAPE);
+
+ CursorShapeInfo* info = packet->mutable_cursor_shape();
+ info->set_width(16);
+ info->set_height(16);
+ info->set_hotspot_x(0);
+ info->set_hotspot_y(0);
+
+ packet->mutable_data()->resize(16 * 16 * 4);
+ uint8* data = const_cast<uint8*>(reinterpret_cast<const uint8*>(
+ packet->mutable_data()->data()));
+ // TODO(garykac) Copy real cursor data into packet.
Wez 2012/05/16 00:20:04 Copying the data should be implemented in this CL,
garykac 2012/05/22 00:42:03 Done.
+ for (int y = 0; y < 16; y++) {
+ for (int x = 0; x < 16; x++) {
+ *data++ = 0xff;
+ *data++ = 0xff;
+ *data++ = 0xff;
+ *data++ = 0xff;
+ }
+ }
+
+ network_loop_->PostTask(
+ FROM_HERE, base::Bind(&ScreenRecorder::DoSendVideoPacket, this,
+ base::Passed(packet.Pass())));
+}
+
void ScreenRecorder::DoStopOnEncodeThread(const base::Closure& done_task) {
DCHECK_EQ(encode_loop_, MessageLoop::current());

Powered by Google App Engine
This is Rietveld 408576698