OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/base/decoder_zlib.h" | 5 #include "remoting/base/decoder_zlib.h" |
6 | 6 |
7 #include "remoting/base/decompressor_zlib.h" | 7 #include "remoting/base/decompressor_zlib.h" |
8 #include "remoting/base/protocol_util.h" | 8 #include "remoting/base/protocol_util.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
11 | 11 |
12 DecoderZlib::DecoderZlib() | 12 DecoderZlib::DecoderZlib() |
13 : state_(kWaitingForBeginRect), | 13 : state_(kWaitingForBeginRect), |
14 rect_x_(0), | 14 rect_x_(0), |
15 rect_y_(0), | 15 rect_y_(0), |
16 rect_width_(0), | 16 rect_width_(0), |
17 rect_height_(0), | 17 rect_height_(0), |
18 bytes_per_pixel_(0), | 18 bytes_per_pixel_(0), |
19 updated_rects_(NULL), | 19 updated_rects_(NULL), |
20 row_pos_(0), | 20 row_pos_(0), |
21 row_y_(0) { | 21 row_y_(0) { |
22 } | 22 } |
23 | 23 |
24 bool DecoderZlib::BeginDecode(scoped_refptr<media::VideoFrame> frame, | 24 bool DecoderZlib::BeginDecode(scoped_refptr<media::VideoFrame> frame, |
25 UpdatedRects* updated_rects, | 25 UpdatedRects* updated_rects, |
26 Task* partial_decode_done, | 26 Task* partial_decode_done, |
27 Task* decode_done) { | 27 Task* decode_done) { |
28 DCHECK(!partial_decode_done_.get()); | 28 DCHECK(!partial_decode_done_.get()); |
29 DCHECK(!decode_done_.get()); | 29 DCHECK(!decode_done_.get()); |
30 DCHECK(!updated_rects_); | 30 DCHECK(!updated_rects_); |
31 DCHECK_EQ(kWaitingForBeginRect, state_); | 31 DCHECK_EQ(kWaitingForBeginRect, state_); |
32 CHECK(static_cast<PixelFormat>(frame->format()) == PixelFormatRgb32) | 32 |
33 << "Only RGB32 is supported"; | 33 if (static_cast<PixelFormat>(frame->format()) != PixelFormatRgb32) { |
| 34 LOG(INFO) << "DecoderZlib only supports RGB32."; |
| 35 return false; |
| 36 } |
34 | 37 |
35 partial_decode_done_.reset(partial_decode_done); | 38 partial_decode_done_.reset(partial_decode_done); |
36 decode_done_.reset(decode_done); | 39 decode_done_.reset(decode_done); |
37 updated_rects_ = updated_rects; | 40 updated_rects_ = updated_rects; |
38 frame_ = frame; | 41 frame_ = frame; |
39 | 42 |
40 // Create the decompressor. | 43 // Create the decompressor. |
41 decompressor_.reset(new DecompressorZlib()); | 44 decompressor_.reset(new DecompressorZlib()); |
42 return true; | 45 return true; |
43 } | 46 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 state_ = kWaitingForBeginRect; | 137 state_ = kWaitingForBeginRect; |
135 | 138 |
136 updated_rects_->clear(); | 139 updated_rects_->clear(); |
137 updated_rects_->push_back(gfx::Rect(rect_x_, rect_y_, | 140 updated_rects_->push_back(gfx::Rect(rect_x_, rect_y_, |
138 rect_width_, rect_height_)); | 141 rect_width_, rect_height_)); |
139 partial_decode_done_->Run(); | 142 partial_decode_done_->Run(); |
140 return true; | 143 return true; |
141 } | 144 } |
142 | 145 |
143 } // namespace remoting | 146 } // namespace remoting |
OLD | NEW |