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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 int width, | 80 int width, |
81 int height, | 81 int height, |
82 int stride_y, | 82 int stride_y, |
83 int stride_u, | 83 int stride_u, |
84 int stride_v, | 84 int stride_v, |
85 VideoRotation rotation) { | 85 VideoRotation rotation) { |
86 const int half_height = (height + 1) / 2; | 86 const int half_height = (height + 1) / 2; |
87 const int expected_size_y = height * stride_y; | 87 const int expected_size_y = height * stride_y; |
88 const int expected_size_u = half_height * stride_u; | 88 const int expected_size_u = half_height * stride_u; |
89 const int expected_size_v = half_height * stride_v; | 89 const int expected_size_v = half_height * stride_v; |
90 CreateEmptyFrame(width, height, stride_y, stride_u, stride_v); | 90 // Allocate a new buffer. |
91 memcpy(video_frame_buffer_->MutableDataY(), buffer_y, expected_size_y); | 91 rtc::scoped_refptr<I420Buffer> buffer_ = |
92 memcpy(video_frame_buffer_->MutableDataU(), buffer_u, expected_size_u); | 92 I420Buffer::Create(width, height, stride_y, stride_u, stride_v); |
93 memcpy(video_frame_buffer_->MutableDataV(), buffer_v, expected_size_v); | 93 |
| 94 memcpy(buffer_->MutableDataY(), buffer_y, expected_size_y); |
| 95 memcpy(buffer_->MutableDataU(), buffer_u, expected_size_u); |
| 96 memcpy(buffer_->MutableDataV(), buffer_v, expected_size_v); |
| 97 |
| 98 video_frame_buffer_ = buffer_; |
| 99 timestamp_rtp_ = 0; |
| 100 ntp_time_ms_ = 0; |
| 101 timestamp_us_ = 0; |
94 rotation_ = rotation; | 102 rotation_ = rotation; |
95 } | 103 } |
96 | 104 |
97 void VideoFrame::CreateFrame(const uint8_t* buffer, | 105 void VideoFrame::CreateFrame(const uint8_t* buffer, |
98 int width, | 106 int width, |
99 int height, | 107 int height, |
100 VideoRotation rotation) { | 108 VideoRotation rotation) { |
101 const int stride_y = width; | 109 const int stride_y = width; |
102 const int stride_uv = (width + 1) / 2; | 110 const int stride_uv = (width + 1) / 2; |
103 | 111 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 case kVideoCodecULPFEC: | 184 case kVideoCodecULPFEC: |
177 case kVideoCodecGeneric: | 185 case kVideoCodecGeneric: |
178 case kVideoCodecUnknown: | 186 case kVideoCodecUnknown: |
179 return 0; | 187 return 0; |
180 } | 188 } |
181 RTC_NOTREACHED(); | 189 RTC_NOTREACHED(); |
182 return 0; | 190 return 0; |
183 } | 191 } |
184 | 192 |
185 } // namespace webrtc | 193 } // namespace webrtc |
OLD | NEW |