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

Side by Side Diff: talk/media/webrtc/webrtcvideoframe.cc

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 VideoFrame* WebRtcVideoFrame::Copy() const { 171 VideoFrame* WebRtcVideoFrame::Copy() const {
172 WebRtcVideoFrame* new_frame = new WebRtcVideoFrame( 172 WebRtcVideoFrame* new_frame = new WebRtcVideoFrame(
173 video_frame_buffer_, elapsed_time_ns_, time_stamp_ns_, rotation_); 173 video_frame_buffer_, elapsed_time_ns_, time_stamp_ns_, rotation_);
174 new_frame->pixel_width_ = pixel_width_; 174 new_frame->pixel_width_ = pixel_width_;
175 new_frame->pixel_height_ = pixel_height_; 175 new_frame->pixel_height_ = pixel_height_;
176 return new_frame; 176 return new_frame;
177 } 177 }
178 178
179 bool WebRtcVideoFrame::MakeExclusive() { 179 bool WebRtcVideoFrame::MakeExclusive() {
180 DCHECK(video_frame_buffer_->native_handle() == nullptr); 180 RTC_DCHECK(video_frame_buffer_->native_handle() == nullptr);
181 if (IsExclusive()) 181 if (IsExclusive())
182 return true; 182 return true;
183 183
184 // Not exclusive already, need to copy buffer. 184 // Not exclusive already, need to copy buffer.
185 rtc::scoped_refptr<webrtc::VideoFrameBuffer> new_buffer = 185 rtc::scoped_refptr<webrtc::VideoFrameBuffer> new_buffer =
186 new rtc::RefCountedObject<webrtc::I420Buffer>( 186 new rtc::RefCountedObject<webrtc::I420Buffer>(
187 video_frame_buffer_->width(), video_frame_buffer_->height(), 187 video_frame_buffer_->width(), video_frame_buffer_->height(),
188 video_frame_buffer_->stride(kYPlane), 188 video_frame_buffer_->stride(kYPlane),
189 video_frame_buffer_->stride(kUPlane), 189 video_frame_buffer_->stride(kUPlane),
190 video_frame_buffer_->stride(kVPlane)); 190 video_frame_buffer_->stride(kVPlane));
191 191
192 if (!CopyToPlanes( 192 if (!CopyToPlanes(
193 new_buffer->MutableData(kYPlane), new_buffer->MutableData(kUPlane), 193 new_buffer->MutableData(kYPlane), new_buffer->MutableData(kUPlane),
194 new_buffer->MutableData(kVPlane), new_buffer->stride(kYPlane), 194 new_buffer->MutableData(kVPlane), new_buffer->stride(kYPlane),
195 new_buffer->stride(kUPlane), new_buffer->stride(kVPlane))) { 195 new_buffer->stride(kUPlane), new_buffer->stride(kVPlane))) {
196 return false; 196 return false;
197 } 197 }
198 198
199 video_frame_buffer_ = new_buffer; 199 video_frame_buffer_ = new_buffer;
200 return true; 200 return true;
201 } 201 }
202 202
203 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32 to_fourcc, uint8* buffer, 203 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32 to_fourcc, uint8* buffer,
204 size_t size, int stride_rgb) const { 204 size_t size, int stride_rgb) const {
205 CHECK(video_frame_buffer_); 205 RTC_CHECK(video_frame_buffer_);
206 CHECK(video_frame_buffer_->native_handle() == nullptr); 206 RTC_CHECK(video_frame_buffer_->native_handle() == nullptr);
207 return VideoFrame::ConvertToRgbBuffer(to_fourcc, buffer, size, stride_rgb); 207 return VideoFrame::ConvertToRgbBuffer(to_fourcc, buffer, size, stride_rgb);
208 } 208 }
209 209
210 bool WebRtcVideoFrame::Reset(uint32 format, 210 bool WebRtcVideoFrame::Reset(uint32 format,
211 int w, 211 int w,
212 int h, 212 int h,
213 int dw, 213 int dw,
214 int dh, 214 int dh,
215 uint8* sample, 215 uint8* sample,
216 size_t sample_size, 216 size_t sample_size,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const { 289 const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const {
290 // If the frame is not rotated, the caller should reuse this frame instead of 290 // If the frame is not rotated, the caller should reuse this frame instead of
291 // making a redundant copy. 291 // making a redundant copy.
292 if (GetVideoRotation() == webrtc::kVideoRotation_0) { 292 if (GetVideoRotation() == webrtc::kVideoRotation_0) {
293 return this; 293 return this;
294 } 294 }
295 295
296 // If the video frame is backed up by a native handle, it resides in the GPU 296 // If the video frame is backed up by a native handle, it resides in the GPU
297 // memory which we can't rotate here. The assumption is that the renderers 297 // memory which we can't rotate here. The assumption is that the renderers
298 // which uses GPU to render should be able to rotate themselves. 298 // which uses GPU to render should be able to rotate themselves.
299 DCHECK(!GetNativeHandle()); 299 RTC_DCHECK(!GetNativeHandle());
300 300
301 if (rotated_frame_) { 301 if (rotated_frame_) {
302 return rotated_frame_.get(); 302 return rotated_frame_.get();
303 } 303 }
304 304
305 int width = static_cast<int>(GetWidth()); 305 int width = static_cast<int>(GetWidth());
306 int height = static_cast<int>(GetHeight()); 306 int height = static_cast<int>(GetHeight());
307 307
308 int rotated_width = width; 308 int rotated_width = width;
309 int rotated_height = height; 309 int rotated_height = height;
(...skipping 15 matching lines...) Expand all
325 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(), 325 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(),
326 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(), width, height, 326 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(), width, height,
327 static_cast<libyuv::RotationMode>(GetVideoRotation())); 327 static_cast<libyuv::RotationMode>(GetVideoRotation()));
328 if (ret == 0) { 328 if (ret == 0) {
329 return rotated_frame_.get(); 329 return rotated_frame_.get();
330 } 330 }
331 return nullptr; 331 return nullptr;
332 } 332 }
333 333
334 } // namespace cricket 334 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2_unittest.cc ('k') | talk/media/webrtc/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698