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

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

Issue 1288063004: Simplify FrameConsumer interface. Remove FrameProducer interface. (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
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 webrtc::DesktopSize screen_size(packet.format().screen_width(),
18 screen_buffer_.reset(); 18 packet.format().screen_height());
19 // Allocate the screen buffer, if necessary.
20 if (!screen_size.equals(screen_size_)) {
21 screen_size_ = screen_size;
22 screen_buffer_.reset(new uint8[screen_size_.width() *
23 screen_size_.height() * kBytesPerPixel]);
24 }
19 25
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; 26 webrtc::DesktopRegion region;
31 27
32 const char* in = packet.data().data(); 28 const char* in = packet.data().data();
33 int stride = kBytesPerPixel * screen_size_.width(); 29 int stride = kBytesPerPixel * screen_size_.width();
34 for (int i = 0; i < packet.dirty_rects_size(); ++i) { 30 for (int i = 0; i < packet.dirty_rects_size(); ++i) {
35 Rect proto_rect = packet.dirty_rects(i); 31 Rect proto_rect = packet.dirty_rects(i);
36 webrtc::DesktopRect rect = 32 webrtc::DesktopRect rect =
37 webrtc::DesktopRect::MakeXYWH(proto_rect.x(), 33 webrtc::DesktopRect::MakeXYWH(proto_rect.x(),
38 proto_rect.y(), 34 proto_rect.y(),
39 proto_rect.width(), 35 proto_rect.width(),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 101 }
106 102
107 updated_region_.Clear(); 103 updated_region_.Clear();
108 } 104 }
109 105
110 const webrtc::DesktopRegion* VideoDecoderVerbatim::GetImageShape() { 106 const webrtc::DesktopRegion* VideoDecoderVerbatim::GetImageShape() {
111 return nullptr; 107 return nullptr;
112 } 108 }
113 109
114 } // namespace remoting 110 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698