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

Side by Side Diff: webrtc/test/fake_texture_frame.h

Issue 1304143003: VideoFrameBuffer: Make non-const data access explicit (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
« no previous file with comments | « webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 #ifndef WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_ 10 #ifndef WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_
(...skipping 16 matching lines...) Expand all
27 ~FakeNativeHandleBuffer() { 27 ~FakeNativeHandleBuffer() {
28 delete reinterpret_cast<FakeNativeHandle*>(native_handle_); 28 delete reinterpret_cast<FakeNativeHandle*>(native_handle_);
29 } 29 }
30 30
31 private: 31 private:
32 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override { 32 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override {
33 rtc::scoped_refptr<VideoFrameBuffer> buffer( 33 rtc::scoped_refptr<VideoFrameBuffer> buffer(
34 new rtc::RefCountedObject<I420Buffer>(width_, height_)); 34 new rtc::RefCountedObject<I420Buffer>(width_, height_));
35 int half_height = (height_ + 1) / 2; 35 int half_height = (height_ + 1) / 2;
36 int half_width = (width_ + 1) / 2; 36 int half_width = (width_ + 1) / 2;
37 memset(buffer->data(kYPlane), 0, height_ * width_); 37 memset(buffer->MutableData(kYPlane), 0, height_ * width_);
38 memset(buffer->data(kUPlane), 0, half_height * half_width); 38 memset(buffer->MutableData(kUPlane), 0, half_height * half_width);
39 memset(buffer->data(kVPlane), 0, half_height * half_width); 39 memset(buffer->MutableData(kVPlane), 0, half_height * half_width);
40 return buffer; 40 return buffer;
41 } 41 }
42 }; 42 };
43 43
44 static VideoFrame CreateFakeNativeHandleFrame(FakeNativeHandle* native_handle, 44 static VideoFrame CreateFakeNativeHandleFrame(FakeNativeHandle* native_handle,
45 int width, 45 int width,
46 int height, 46 int height,
47 uint32_t timestamp, 47 uint32_t timestamp,
48 int64_t render_time_ms, 48 int64_t render_time_ms,
49 VideoRotation rotation) { 49 VideoRotation rotation) {
50 return VideoFrame(new rtc::RefCountedObject<FakeNativeHandleBuffer>( 50 return VideoFrame(new rtc::RefCountedObject<FakeNativeHandleBuffer>(
51 native_handle, width, height), 51 native_handle, width, height),
52 timestamp, render_time_ms, rotation); 52 timestamp, render_time_ms, rotation);
53 } 53 }
54 } // namespace test 54 } // namespace test
55 } // namespace webrtc 55 } // namespace webrtc
56 #endif // WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_ 56 #endif // WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698