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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 RTC_DCHECK_GE(stride_y, width); | 59 RTC_DCHECK_GE(stride_y, width); |
60 RTC_DCHECK_GE(stride_u, half_width); | 60 RTC_DCHECK_GE(stride_u, half_width); |
61 RTC_DCHECK_GE(stride_v, half_width); | 61 RTC_DCHECK_GE(stride_v, half_width); |
62 | 62 |
63 // Creating empty frame - reset all values. | 63 // Creating empty frame - reset all values. |
64 timestamp_ = 0; | 64 timestamp_ = 0; |
65 ntp_time_ms_ = 0; | 65 ntp_time_ms_ = 0; |
66 render_time_ms_ = 0; | 66 render_time_ms_ = 0; |
67 rotation_ = kVideoRotation_0; | 67 rotation_ = kVideoRotation_0; |
68 | 68 |
69 // Check if it's safe to reuse allocation. | 69 // Allocate a new buffer. |
pbos-webrtc
2016/05/25 15:26:07
Should this check if video_frame_buffer_->HasOneRe
nisse-webrtc
2016/05/26 07:44:42
It was used by the frame factory, that's why I cha
| |
70 if (video_frame_buffer_ && video_frame_buffer_->IsMutable() && | |
71 !video_frame_buffer_->native_handle() && | |
72 width == video_frame_buffer_->width() && | |
73 height == video_frame_buffer_->height() && | |
74 stride_y == video_frame_buffer_->StrideY() && | |
75 stride_u == video_frame_buffer_->StrideU() && | |
76 stride_v == video_frame_buffer_->StrideV()) { | |
77 return; | |
78 } | |
79 | |
80 // Need to allocate new buffer. | |
81 video_frame_buffer_ = new rtc::RefCountedObject<I420Buffer>( | 70 video_frame_buffer_ = new rtc::RefCountedObject<I420Buffer>( |
82 width, height, stride_y, stride_u, stride_v); | 71 width, height, stride_y, stride_u, stride_v); |
83 } | 72 } |
84 | 73 |
85 void VideoFrame::CreateFrame(const uint8_t* buffer_y, | 74 void VideoFrame::CreateFrame(const uint8_t* buffer_y, |
86 const uint8_t* buffer_u, | 75 const uint8_t* buffer_u, |
87 const uint8_t* buffer_v, | 76 const uint8_t* buffer_v, |
88 int width, | 77 int width, |
89 int height, | 78 int height, |
90 int stride_y, | 79 int stride_y, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 case kVideoCodecULPFEC: | 187 case kVideoCodecULPFEC: |
199 case kVideoCodecGeneric: | 188 case kVideoCodecGeneric: |
200 case kVideoCodecUnknown: | 189 case kVideoCodecUnknown: |
201 return 0; | 190 return 0; |
202 } | 191 } |
203 RTC_NOTREACHED(); | 192 RTC_NOTREACHED(); |
204 return 0; | 193 return 0; |
205 } | 194 } |
206 | 195 |
207 } // namespace webrtc | 196 } // namespace webrtc |
OLD | NEW |