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

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

Issue 2049513005: Reland of New method I420Buffer::SetToBlack. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Keep (but deprecate) InitToBlack method. Created 4 years, 6 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 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, 60 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh,
61 bool apply_rotation) { 61 bool apply_rotation) {
62 return Reset(frame->fourcc, frame->width, frame->height, dw, dh, 62 return Reset(frame->fourcc, frame->width, frame->height, dw, dh,
63 static_cast<uint8_t*>(frame->data), frame->data_size, 63 static_cast<uint8_t*>(frame->data), frame->data_size,
64 frame->time_stamp / rtc::kNumNanosecsPerMicrosec, 64 frame->time_stamp / rtc::kNumNanosecsPerMicrosec,
65 frame->rotation, apply_rotation); 65 frame->rotation, apply_rotation);
66 } 66 }
67 67
68 // TODO(nisse): Deprecated, delete as soon as Chrome is updated.
68 bool WebRtcVideoFrame::InitToBlack(int w, int h, 69 bool WebRtcVideoFrame::InitToBlack(int w, int h,
69 int64_t time_stamp_ns) { 70 int64_t time_stamp_ns) {
70 InitToEmptyBuffer(w, h, time_stamp_ns); 71 rtc::scoped_refptr<webrtc::I420Buffer> buffer(
71 return SetToBlack(); 72 new rtc::RefCountedObject<webrtc::I420Buffer>(w, h));
73 buffer->SetToBlack();
74
75 video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h);
76 SetTimeStamp(time_stamp_ns);
77 rotation_ = webrtc::kVideoRotation_0;
78
79 return true;
72 } 80 }
73 81
74 int WebRtcVideoFrame::width() const { 82 int WebRtcVideoFrame::width() const {
75 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; 83 return video_frame_buffer_ ? video_frame_buffer_->width() : 0;
76 } 84 }
77 85
78 int WebRtcVideoFrame::height() const { 86 int WebRtcVideoFrame::height() const {
79 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; 87 return video_frame_buffer_ ? video_frame_buffer_->height() : 0;
80 } 88 }
81 89
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 rotated_frame_->video_frame_buffer()->StrideV(), 227 rotated_frame_->video_frame_buffer()->StrideV(),
220 orig_width, orig_height, 228 orig_width, orig_height,
221 static_cast<libyuv::RotationMode>(rotation())); 229 static_cast<libyuv::RotationMode>(rotation()));
222 if (ret == 0) { 230 if (ret == 0) {
223 return rotated_frame_.get(); 231 return rotated_frame_.get();
224 } 232 }
225 return nullptr; 233 return nullptr;
226 } 234 }
227 235
228 } // namespace cricket 236 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.h ('k') | webrtc/media/engine/webrtcvideoframe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698