OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 int width, | 71 int width, |
72 int height, | 72 int height, |
73 int stride_y, | 73 int stride_y, |
74 int stride_u, | 74 int stride_u, |
75 int stride_v, | 75 int stride_v, |
76 VideoRotation rotation) { | 76 VideoRotation rotation) { |
77 const int half_height = (height + 1) / 2; | 77 const int half_height = (height + 1) / 2; |
78 const int expected_size_y = height * stride_y; | 78 const int expected_size_y = height * stride_y; |
79 const int expected_size_u = half_height * stride_u; | 79 const int expected_size_u = half_height * stride_u; |
80 const int expected_size_v = half_height * stride_v; | 80 const int expected_size_v = half_height * stride_v; |
81 CreateEmptyFrame(width, height, stride_y, stride_u, stride_v); | 81 // Allocate a new buffer. |
perkj_webrtc
2016/09/13 15:29:22
Remove CreateEmptyFrame?
nisse-webrtc
2016/09/14 06:59:05
I do want to remove CreateEmptyFrame. And the defa
| |
82 memcpy(video_frame_buffer_->MutableDataY(), buffer_y, expected_size_y); | 82 rtc::scoped_refptr<I420Buffer> buffer_ = |
83 memcpy(video_frame_buffer_->MutableDataU(), buffer_u, expected_size_u); | 83 I420Buffer::Create(width, height, stride_y, stride_u, stride_v); |
84 memcpy(video_frame_buffer_->MutableDataV(), buffer_v, expected_size_v); | 84 |
85 memcpy(buffer_->MutableDataY(), buffer_y, expected_size_y); | |
86 memcpy(buffer_->MutableDataU(), buffer_u, expected_size_u); | |
87 memcpy(buffer_->MutableDataV(), buffer_v, expected_size_v); | |
88 | |
89 video_frame_buffer_ = buffer_; | |
90 timestamp_ = 0; | |
91 ntp_time_ms_ = 0; | |
92 render_time_ms_ = 0; | |
85 rotation_ = rotation; | 93 rotation_ = rotation; |
86 } | 94 } |
87 | 95 |
88 void VideoFrame::CreateFrame(const uint8_t* buffer, | 96 void VideoFrame::CreateFrame(const uint8_t* buffer, |
89 int width, | 97 int width, |
90 int height, | 98 int height, |
91 VideoRotation rotation) { | 99 VideoRotation rotation) { |
92 const int stride_y = width; | 100 const int stride_y = width; |
93 const int stride_uv = (width + 1) / 2; | 101 const int stride_uv = (width + 1) / 2; |
94 | 102 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 case kVideoCodecULPFEC: | 175 case kVideoCodecULPFEC: |
168 case kVideoCodecGeneric: | 176 case kVideoCodecGeneric: |
169 case kVideoCodecUnknown: | 177 case kVideoCodecUnknown: |
170 return 0; | 178 return 0; |
171 } | 179 } |
172 RTC_NOTREACHED(); | 180 RTC_NOTREACHED(); |
173 return 0; | 181 return 0; |
174 } | 182 } |
175 | 183 |
176 } // namespace webrtc | 184 } // namespace webrtc |
OLD | NEW |