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

Unified Diff: remoting/host/video_frame_capturer_win.cc

Issue 10806074: Make sure VideoFrameBufferWin::VideoFrameBuffer::resource_generation is properly initialized. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/video_frame_capturer_win.cc
diff --git a/remoting/host/video_frame_capturer_win.cc b/remoting/host/video_frame_capturer_win.cc
index 86c142dd14e9a26906de93c8f5c7945676cbb52e..69daecce021eeca390aec0cfd0733252c45084a6 100644
--- a/remoting/host/video_frame_capturer_win.cc
+++ b/remoting/host/video_frame_capturer_win.cc
@@ -57,17 +57,8 @@ class VideoFrameCapturerWin : public VideoFrameCapturer {
private:
struct VideoFrameBuffer {
- VideoFrameBuffer(void* data, const SkISize& size, int bytes_per_pixel,
- int bytes_per_row)
- : data(data), size(size), bytes_per_pixel(bytes_per_pixel),
- bytes_per_row(bytes_per_row) {
- }
- VideoFrameBuffer() {
- data = 0;
- size = SkISize::Make(0, 0);
- bytes_per_pixel = 0;
- bytes_per_row = 0;
- }
+ VideoFrameBuffer();
+
void* data;
SkISize size;
int bytes_per_pixel;
@@ -81,7 +72,7 @@ class VideoFrameCapturerWin : public VideoFrameCapturer {
// Allocates the specified capture buffer using the current device contexts
// and desktop dimensions, releasing any pre-existing buffer.
- void AllocateBuffer(int buffer_index);
+ void AllocateBuffer(int buffer_index, int resource_generation);
void CalculateInvalidRegion();
void CaptureRegion(const SkRegion& region,
@@ -145,6 +136,14 @@ static const int kPixelsPerMeter = 3780;
// 32 bit RGBA is 4 bytes per pixel.
static const int kBytesPerPixel = 4;
+VideoFrameCapturerWin::VideoFrameBuffer::VideoFrameBuffer()
+ : data(NULL),
+ size(SkISize::Make(0, 0)),
+ bytes_per_pixel(0),
+ bytes_per_row(0),
+ resource_generation(0) {
+}
+
VideoFrameCapturerWin::VideoFrameCapturerWin()
: last_cursor_size_(SkISize::Make(0, 0)),
desktop_dc_rect_(SkIRect::MakeEmpty()),
@@ -257,7 +256,7 @@ void VideoFrameCapturerWin::PrepareCaptureResources() {
// Note that we can't reallocate other buffers at this point, since the caller
// may still be reading from them.
if (resource_generation_ != buffers_[current_buffer_].resource_generation) {
- AllocateBuffer(current_buffer_);
+ AllocateBuffer(current_buffer_, resource_generation_);
SkRegion region;
region.op(SkIRect::MakeSize(helper_.size_most_recent()),
@@ -266,7 +265,8 @@ void VideoFrameCapturerWin::PrepareCaptureResources() {
}
}
-void VideoFrameCapturerWin::AllocateBuffer(int buffer_index) {
+void VideoFrameCapturerWin::AllocateBuffer(int buffer_index,
+ int resource_generation) {
DCHECK(desktop_dc_.get() != NULL);
DCHECK(memory_dc_.Get() != NULL);
// Windows requires DIB sections' rows to start DWORD-aligned, which is
@@ -296,6 +296,7 @@ void VideoFrameCapturerWin::AllocateBuffer(int buffer_index) {
buffers_[buffer_index].bytes_per_pixel = bmi.bmiHeader.biBitCount / 8;
buffers_[buffer_index].bytes_per_row =
bmi.bmiHeader.biSizeImage / std::abs(bmi.bmiHeader.biHeight);
+ buffers_[buffer_index].resource_generation = resource_generation;
}
void VideoFrameCapturerWin::CalculateInvalidRegion() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698