OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client/rectangle_update_decoder.h" | 5 #include "remoting/client/rectangle_update_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "ppapi/cpp/image_data.h" | 13 #include "ppapi/cpp/image_data.h" |
14 #include "remoting/base/util.h" | 14 #include "remoting/base/util.h" |
15 #include "remoting/codec/video_decoder.h" | 15 #include "remoting/codec/video_decoder.h" |
16 #include "remoting/codec/video_decoder_row_based.h" | 16 #include "remoting/codec/video_decoder_verbatim.h" |
17 #include "remoting/codec/video_decoder_vp8.h" | 17 #include "remoting/codec/video_decoder_vp8.h" |
18 #include "remoting/client/frame_consumer.h" | 18 #include "remoting/client/frame_consumer.h" |
19 #include "remoting/protocol/session_config.h" | 19 #include "remoting/protocol/session_config.h" |
20 | 20 |
21 using base::Passed; | 21 using base::Passed; |
22 using remoting::protocol::ChannelConfig; | 22 using remoting::protocol::ChannelConfig; |
23 using remoting::protocol::SessionConfig; | 23 using remoting::protocol::SessionConfig; |
24 | 24 |
25 namespace remoting { | 25 namespace remoting { |
26 | 26 |
(...skipping 12 matching lines...) Expand all Loading... |
39 latest_sequence_number_(0) { | 39 latest_sequence_number_(0) { |
40 } | 40 } |
41 | 41 |
42 RectangleUpdateDecoder::~RectangleUpdateDecoder() { | 42 RectangleUpdateDecoder::~RectangleUpdateDecoder() { |
43 } | 43 } |
44 | 44 |
45 void RectangleUpdateDecoder::Initialize(const SessionConfig& config) { | 45 void RectangleUpdateDecoder::Initialize(const SessionConfig& config) { |
46 // Initialize decoder based on the selected codec. | 46 // Initialize decoder based on the selected codec. |
47 ChannelConfig::Codec codec = config.video_config().codec; | 47 ChannelConfig::Codec codec = config.video_config().codec; |
48 if (codec == ChannelConfig::CODEC_VERBATIM) { | 48 if (codec == ChannelConfig::CODEC_VERBATIM) { |
49 decoder_.reset(VideoDecoderRowBased::CreateVerbatimDecoder()); | 49 decoder_.reset(new VideoDecoderVerbatim()); |
50 } else if (codec == ChannelConfig::CODEC_ZIP) { | |
51 decoder_.reset(VideoDecoderRowBased::CreateZlibDecoder()); | |
52 } else if (codec == ChannelConfig::CODEC_VP8) { | 50 } else if (codec == ChannelConfig::CODEC_VP8) { |
53 decoder_.reset(new VideoDecoderVp8()); | 51 decoder_.reset(new VideoDecoderVp8()); |
54 } else { | 52 } else { |
55 NOTREACHED() << "Invalid Encoding found: " << codec; | 53 NOTREACHED() << "Invalid Encoding found: " << codec; |
56 } | 54 } |
57 } | 55 } |
58 | 56 |
59 void RectangleUpdateDecoder::DecodePacket(scoped_ptr<VideoPacket> packet, | 57 void RectangleUpdateDecoder::DecodePacket(scoped_ptr<VideoPacket> packet, |
60 const base::Closure& done) { | 58 const base::Closure& done) { |
61 DCHECK(decode_task_runner_->BelongsToCurrentThread()); | 59 DCHECK(decode_task_runner_->BelongsToCurrentThread()); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 285 |
288 done.Run(); | 286 done.Run(); |
289 } | 287 } |
290 | 288 |
291 ChromotingStats* RectangleUpdateDecoder::GetStats() { | 289 ChromotingStats* RectangleUpdateDecoder::GetStats() { |
292 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 290 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
293 return &stats_; | 291 return &stats_; |
294 } | 292 } |
295 | 293 |
296 } // namespace remoting | 294 } // namespace remoting |
OLD | NEW |