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

Side by Side Diff: remoting/base/util.cc

Issue 7355011: Modify Chromoting logging to hook into base logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/base/util.h ('k') | remoting/client/chromoting_client.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/logging.h"
6 #include "base/stringprintf.h"
5 #include "media/base/video_frame.h" 7 #include "media/base/video_frame.h"
6 #include "media/base/yuv_convert.h" 8 #include "media/base/yuv_convert.h"
7 #include "remoting/base/util.h" 9 #include "remoting/base/util.h"
8 10
9 #include "base/logging.h"
10
11 using media::VideoFrame; 11 using media::VideoFrame;
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 std::string GetTimestampString() {
16 // This code is modeled after the timestamp code in LogMessage::Init() (in
17 // base/logging.cc).
18 time_t t = time(NULL);
Sergey Ulanov 2011/08/02 02:21:56 It's better to use base::Time here.
garykac 2011/08/02 18:07:02 Done.
19 struct tm local_time = {0};
20 #if _MSC_VER >= 1400
21 localtime_s(&local_time, &t);
22 #else
23 localtime_r(&t, &local_time);
24 #endif
25 struct tm* tm_time = &local_time;
26 return StringPrintf("%02d%02d/%02d%02d%02d:",
27 1 + tm_time->tm_mon, tm_time->tm_mday,
28 tm_time->tm_hour, tm_time->tm_min, tm_time->tm_sec);
29 }
30
15 int GetBytesPerPixel(VideoFrame::Format format) { 31 int GetBytesPerPixel(VideoFrame::Format format) {
16 // Note: The order is important here for performance. This is sorted from the 32 // Note: The order is important here for performance. This is sorted from the
17 // most common to the less common (PIXEL_FORMAT_ASCII is mostly used 33 // most common to the less common (PIXEL_FORMAT_ASCII is mostly used
18 // just for testing). 34 // just for testing).
19 switch (format) { 35 switch (format) {
20 case VideoFrame::RGB24: return 3; 36 case VideoFrame::RGB24: return 3;
21 case VideoFrame::RGB565: return 2; 37 case VideoFrame::RGB565: return 2;
22 case VideoFrame::RGB32: return 4; 38 case VideoFrame::RGB32: return 4;
23 case VideoFrame::ASCII: return 1; 39 case VideoFrame::ASCII: return 1;
24 default: 40 default:
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const int bytes_per_line = bytes_per_pixel * rect.width(); 179 const int bytes_per_line = bytes_per_pixel * rect.width();
164 const int height = rect.height(); 180 const int height = rect.height();
165 for (int i = 0 ; i < height; ++i) { 181 for (int i = 0 ; i < height; ++i) {
166 memcpy(dest_plane, src_plane, bytes_per_line); 182 memcpy(dest_plane, src_plane, bytes_per_line);
167 src_plane += src_plane_stride; 183 src_plane += src_plane_stride;
168 dest_plane += dest_plane_stride; 184 dest_plane += dest_plane_stride;
169 } 185 }
170 } 186 }
171 187
172 } // namespace remoting 188 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/util.h ('k') | remoting/client/chromoting_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698