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