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

Side by Side Diff: remoting/codec/video_decoder_verbatim.cc

Issue 1298863003: Remove VideoDecoder::Initialize(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « remoting/codec/video_decoder_verbatim.h ('k') | remoting/codec/video_decoder_vpx.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/codec/video_decoder_verbatim.h" 5 #include "remoting/codec/video_decoder_verbatim.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "remoting/base/util.h" 8 #include "remoting/base/util.h"
9 9
10 namespace remoting { 10 namespace remoting {
11 11
12 VideoDecoderVerbatim::VideoDecoderVerbatim() {} 12 VideoDecoderVerbatim::VideoDecoderVerbatim() {}
13 13
14 VideoDecoderVerbatim::~VideoDecoderVerbatim() {} 14 VideoDecoderVerbatim::~VideoDecoderVerbatim() {}
15 15
16 void VideoDecoderVerbatim::Initialize(const webrtc::DesktopSize& screen_size) { 16 bool VideoDecoderVerbatim::DecodePacket(const VideoPacket& packet) {
17 updated_region_.Clear(); 17 if (packet.format().has_screen_width() &&
18 screen_buffer_.reset(); 18 packet.format().has_screen_height()) {
19 webrtc::DesktopSize screen_size(packet.format().screen_width(),
20 packet.format().screen_height());
21 // Allocate the screen buffer, if necessary.
22 if (!screen_size.equals(screen_size_)) {
23 screen_size_ = screen_size;
24 screen_buffer_.reset(new uint8[screen_size_.width() *
25 screen_size_.height() * kBytesPerPixel]);
Jamie 2015/08/19 00:16:32 Do you need to call updated_region_.Clear() as wel
Sergey Ulanov 2015/08/19 00:43:53 Done.
26 }
27 }
19 28
20 screen_size_ = screen_size;
21 // Allocate the screen buffer, if necessary.
22 if (!screen_size_.is_empty()) {
23 screen_buffer_.reset(
24 new uint8[screen_size_.width() * screen_size_.height() *
25 kBytesPerPixel]);
26 }
27 }
28
29 bool VideoDecoderVerbatim::DecodePacket(const VideoPacket& packet) {
30 webrtc::DesktopRegion region; 29 webrtc::DesktopRegion region;
31 30
32 const char* in = packet.data().data(); 31 const char* in = packet.data().data();
33 int stride = kBytesPerPixel * screen_size_.width(); 32 int stride = kBytesPerPixel * screen_size_.width();
34 for (int i = 0; i < packet.dirty_rects_size(); ++i) { 33 for (int i = 0; i < packet.dirty_rects_size(); ++i) {
35 Rect proto_rect = packet.dirty_rects(i); 34 Rect proto_rect = packet.dirty_rects(i);
36 webrtc::DesktopRect rect = 35 webrtc::DesktopRect rect =
37 webrtc::DesktopRect::MakeXYWH(proto_rect.x(), 36 webrtc::DesktopRect::MakeXYWH(proto_rect.x(),
38 proto_rect.y(), 37 proto_rect.y(),
39 proto_rect.width(), 38 proto_rect.width(),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 104 }
106 105
107 updated_region_.Clear(); 106 updated_region_.Clear();
108 } 107 }
109 108
110 const webrtc::DesktopRegion* VideoDecoderVerbatim::GetImageShape() { 109 const webrtc::DesktopRegion* VideoDecoderVerbatim::GetImageShape() {
111 return nullptr; 110 return nullptr;
112 } 111 }
113 112
114 } // namespace remoting 113 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/codec/video_decoder_verbatim.h ('k') | remoting/codec/video_decoder_vpx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698