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

Unified Diff: talk/media/base/videocapturer.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/media/base/videocapturer.h ('k') | talk/media/base/videocapturer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/media/base/videocapturer.cc
diff --git a/talk/media/base/videocapturer.cc b/talk/media/base/videocapturer.cc
index 33cab7189398f71c9b3361c82fbe883d9606bf1a..ca4b9069f11a02f594991e6e2c93d63f39fece99 100644
--- a/talk/media/base/videocapturer.cc
+++ b/talk/media/base/videocapturer.cc
@@ -58,7 +58,7 @@ enum {
MSG_STATE_CHANGE
};
-static const int64 kMaxDistance = ~(static_cast<int64>(1) << 63);
+static const int64_t kMaxDistance = ~(static_cast<int64_t>(1) << 63);
#ifdef LINUX
static const int kYU12Penalty = 16; // Needs to be higher than MJPG index.
#endif
@@ -86,7 +86,7 @@ CapturedFrame::CapturedFrame()
data(NULL) {}
// TODO(fbarchard): Remove this function once lmimediaengine stops using it.
-bool CapturedFrame::GetDataSize(uint32* size) const {
+bool CapturedFrame::GetDataSize(uint32_t* size) const {
if (!size || data_size == CapturedFrame::kUnknownDataSize) {
return false;
}
@@ -275,11 +275,11 @@ bool VideoCapturer::GetBestCaptureFormat(const VideoFormat& format,
return false;
}
LOG(LS_INFO) << " Capture Requested " << format.ToString();
- int64 best_distance = kMaxDistance;
+ int64_t best_distance = kMaxDistance;
std::vector<VideoFormat>::const_iterator best = supported_formats->end();
std::vector<VideoFormat>::const_iterator i;
for (i = supported_formats->begin(); i != supported_formats->end(); ++i) {
- int64 distance = GetFormatDistance(format, *i);
+ int64_t distance = GetFormatDistance(format, *i);
// TODO(fbarchard): Reduce to LS_VERBOSE if/when camera capture is
// relatively bug free.
LOG(LS_INFO) << " Supported " << i->ToString() << " distance " << distance;
@@ -361,7 +361,7 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
}
// Use a temporary buffer to scale
- rtc::scoped_ptr<uint8[]> scale_buffer;
+ rtc::scoped_ptr<uint8_t[]> scale_buffer;
if (IsScreencast()) {
int scaled_width, scaled_height;
@@ -390,16 +390,15 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
CapturedFrame* modified_frame =
const_cast<CapturedFrame*>(captured_frame);
const int modified_frame_size = scaled_width * scaled_height * 4;
- scale_buffer.reset(new uint8[modified_frame_size]);
+ scale_buffer.reset(new uint8_t[modified_frame_size]);
// Compute new width such that width * height is less than maximum but
// maintains original captured frame aspect ratio.
// Round down width to multiple of 4 so odd width won't round up beyond
// maximum, and so chroma channel is even width to simplify spatial
// resampling.
- libyuv::ARGBScale(reinterpret_cast<const uint8*>(captured_frame->data),
+ libyuv::ARGBScale(reinterpret_cast<const uint8_t*>(captured_frame->data),
captured_frame->width * 4, captured_frame->width,
- captured_frame->height,
- scale_buffer.get(),
+ captured_frame->height, scale_buffer.get(),
scaled_width * 4, scaled_width, scaled_height,
libyuv::kFilterBilinear);
modified_frame->width = scaled_width;
@@ -416,7 +415,7 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
// TODO(fbarchard): Avoid scale and convert if muted.
// Temporary buffer is scoped here so it will persist until i420_frame.Init()
// makes a copy of the frame, converting to I420.
- rtc::scoped_ptr<uint8[]> temp_buffer;
+ rtc::scoped_ptr<uint8_t[]> temp_buffer;
// YUY2 can be scaled vertically using an ARGB scaler. Aspect ratio is only
// a problem on OSX. OSX always converts webcams to YUY2 or UYVY.
bool can_scale =
@@ -450,26 +449,26 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
scaled_height_ = scaled_height;
}
const int modified_frame_size = scaled_width * scaled_height * kYuy2Bpp;
- uint8* temp_buffer_data;
+ uint8_t* temp_buffer_data;
// Pixels are wide and short; Increasing height. Requires temporary buffer.
if (scaled_height > captured_frame->height) {
- temp_buffer.reset(new uint8[modified_frame_size]);
+ temp_buffer.reset(new uint8_t[modified_frame_size]);
temp_buffer_data = temp_buffer.get();
} else {
// Pixels are narrow and tall; Decreasing height. Scale will be done
// in place.
- temp_buffer_data = reinterpret_cast<uint8*>(captured_frame->data);
+ temp_buffer_data = reinterpret_cast<uint8_t*>(captured_frame->data);
}
// Use ARGBScaler to vertically scale the YUY2 image, adjusting for 16 bpp.
- libyuv::ARGBScale(reinterpret_cast<const uint8*>(captured_frame->data),
+ libyuv::ARGBScale(reinterpret_cast<const uint8_t*>(captured_frame->data),
captured_frame->width * kYuy2Bpp, // Stride for YUY2.
captured_frame->width * kYuy2Bpp / kArgbBpp, // Width.
- abs(captured_frame->height), // Height.
+ abs(captured_frame->height), // Height.
temp_buffer_data,
- scaled_width * kYuy2Bpp, // Stride for YUY2.
+ scaled_width * kYuy2Bpp, // Stride for YUY2.
scaled_width * kYuy2Bpp / kArgbBpp, // Width.
- abs(scaled_height), // New height.
+ abs(scaled_height), // New height.
libyuv::kFilterBilinear);
modified_frame->width = scaled_width;
modified_frame->height = scaled_height;
@@ -589,16 +588,16 @@ void VideoCapturer::OnMessage(rtc::Message* message) {
// 3) Framerate closeness. If not same, we prefer faster.
// 4) Compression. If desired format has a specific fourcc, we need exact match;
// otherwise, we use preference.
-int64 VideoCapturer::GetFormatDistance(const VideoFormat& desired,
- const VideoFormat& supported) {
- int64 distance = kMaxDistance;
+int64_t VideoCapturer::GetFormatDistance(const VideoFormat& desired,
+ const VideoFormat& supported) {
+ int64_t distance = kMaxDistance;
// Check fourcc.
- uint32 supported_fourcc = CanonicalFourCC(supported.fourcc);
- int64 delta_fourcc = kMaxDistance;
+ uint32_t supported_fourcc = CanonicalFourCC(supported.fourcc);
+ int64_t delta_fourcc = kMaxDistance;
if (FOURCC_ANY == desired.fourcc) {
// Any fourcc is OK for the desired. Use preference to find best fourcc.
- std::vector<uint32> preferred_fourccs;
+ std::vector<uint32_t> preferred_fourccs;
if (!GetPreferredFourccs(&preferred_fourccs)) {
return distance;
}
@@ -629,15 +628,15 @@ int64 VideoCapturer::GetFormatDistance(const VideoFormat& desired,
// Check resolution and fps.
int desired_width = desired.width;
int desired_height = desired.height;
- int64 delta_w = supported.width - desired_width;
+ int64_t delta_w = supported.width - desired_width;
float supported_fps = VideoFormat::IntervalToFpsFloat(supported.interval);
float delta_fps =
supported_fps - VideoFormat::IntervalToFpsFloat(desired.interval);
// Check height of supported height compared to height we would like it to be.
- int64 aspect_h =
- desired_width ? supported.width * desired_height / desired_width
- : desired_height;
- int64 delta_h = supported.height - aspect_h;
+ int64_t aspect_h = desired_width
+ ? supported.width * desired_height / desired_width
+ : desired_height;
+ int64_t delta_h = supported.height - aspect_h;
distance = 0;
// Set high penalty if the supported format is lower than the desired format.
@@ -664,12 +663,12 @@ int64 VideoCapturer::GetFormatDistance(const VideoFormat& desired,
VideoFormat::IntervalToFpsFloat(desired.interval) * 23.f / 30.f;
delta_fps = -delta_fps;
if (supported_fps < min_desirable_fps) {
- distance |= static_cast<int64>(1) << 62;
+ distance |= static_cast<int64_t>(1) << 62;
} else {
- distance |= static_cast<int64>(1) << 15;
+ distance |= static_cast<int64_t>(1) << 15;
}
}
- int64 idelta_fps = static_cast<int>(delta_fps);
+ int64_t idelta_fps = static_cast<int>(delta_fps);
// 12 bits for width and height and 8 bits for fps and fourcc.
distance |=
« no previous file with comments | « talk/media/base/videocapturer.h ('k') | talk/media/base/videocapturer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698