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

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

Issue 2329653002: Add WebrtcVideoEncoder interface (Closed)
Patch Set: win Created 4 years, 3 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_encoder_verbatim.h ('k') | remoting/codec/video_encoder_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_encoder_verbatim.h" 5 #include "remoting/codec/video_encoder_verbatim.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "remoting/base/util.h" 12 #include "remoting/base/util.h"
13 #include "remoting/proto/video.pb.h" 13 #include "remoting/proto/video.pb.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
16 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" 16 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
17 17
18 namespace remoting { 18 namespace remoting {
19 19
20 static uint8_t* GetPacketOutputBuffer(VideoPacket* packet, size_t size) { 20 static uint8_t* GetPacketOutputBuffer(VideoPacket* packet, size_t size) {
21 packet->mutable_data()->resize(size); 21 packet->mutable_data()->resize(size);
22 return reinterpret_cast<uint8_t*>( 22 return reinterpret_cast<uint8_t*>(
23 base::string_as_array(packet->mutable_data())); 23 base::string_as_array(packet->mutable_data()));
24 } 24 }
25 25
26 VideoEncoderVerbatim::VideoEncoderVerbatim() {} 26 VideoEncoderVerbatim::VideoEncoderVerbatim() {}
27 VideoEncoderVerbatim::~VideoEncoderVerbatim() {} 27 VideoEncoderVerbatim::~VideoEncoderVerbatim() {}
28 28
29 std::unique_ptr<VideoPacket> VideoEncoderVerbatim::Encode( 29 std::unique_ptr<VideoPacket> VideoEncoderVerbatim::Encode(
30 const webrtc::DesktopFrame& frame, 30 const webrtc::DesktopFrame& frame) {
31 uint32_t flags) {
32 DCHECK(frame.data()); 31 DCHECK(frame.data());
33 32
34 // If nothing has changed in the frame then return NULL to indicate that 33 // If nothing has changed in the frame then return NULL to indicate that
35 // we don't need to actually send anything (e.g. nothing to top-off). 34 // we don't need to actually send anything (e.g. nothing to top-off).
36 if (frame.updated_region().is_empty()) 35 if (frame.updated_region().is_empty())
37 return nullptr; 36 return nullptr;
38 37
39 // Create a VideoPacket with common fields (e.g. DPI, rects, shape) set. 38 // Create a VideoPacket with common fields (e.g. DPI, rects, shape) set.
40 std::unique_ptr<VideoPacket> packet(helper_.CreateVideoPacket(frame)); 39 std::unique_ptr<VideoPacket> packet(helper_.CreateVideoPacket(frame));
41 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VERBATIM); 40 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VERBATIM);
(...skipping 21 matching lines...) Expand all
63 memcpy(out, in, row_size); 62 memcpy(out, in, row_size);
64 out += row_size; 63 out += row_size;
65 in += in_stride; 64 in += in_stride;
66 } 65 }
67 } 66 }
68 67
69 return packet; 68 return packet;
70 } 69 }
71 70
72 } // namespace remoting 71 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/codec/video_encoder_verbatim.h ('k') | remoting/codec/video_encoder_vpx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698