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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 RTC_DCHECK_GE(stride_u, half_width); | 58 RTC_DCHECK_GE(stride_u, half_width); |
59 RTC_DCHECK_GE(stride_v, half_width); | 59 RTC_DCHECK_GE(stride_v, half_width); |
60 | 60 |
61 // Creating empty frame - reset all values. | 61 // Creating empty frame - reset all values. |
62 timestamp_ = 0; | 62 timestamp_ = 0; |
63 ntp_time_ms_ = 0; | 63 ntp_time_ms_ = 0; |
64 render_time_ms_ = 0; | 64 render_time_ms_ = 0; |
65 rotation_ = kVideoRotation_0; | 65 rotation_ = kVideoRotation_0; |
66 | 66 |
67 // Check if it's safe to reuse allocation. | 67 // Check if it's safe to reuse allocation. |
68 if (video_frame_buffer_ && video_frame_buffer_->IsMutable() && | 68 if (video_frame_buffer_ && video_frame_buffer_->HasOneRef() && |
69 !video_frame_buffer_->native_handle() && | 69 !video_frame_buffer_->native_handle() && |
70 width == video_frame_buffer_->width() && | 70 width == video_frame_buffer_->width() && |
71 height == video_frame_buffer_->height() && stride_y == stride(kYPlane) && | 71 height == video_frame_buffer_->height() && stride_y == stride(kYPlane) && |
72 stride_u == stride(kUPlane) && stride_v == stride(kVPlane)) { | 72 stride_u == stride(kUPlane) && stride_v == stride(kVPlane)) { |
73 return; | 73 return; |
74 } | 74 } |
75 | 75 |
76 // Need to allocate new buffer. | 76 // Need to allocate new buffer. |
77 video_frame_buffer_ = new rtc::RefCountedObject<I420Buffer>( | 77 video_frame_buffer_ = new rtc::RefCountedObject<I420Buffer>( |
78 width, height, stride_y, stride_u, stride_v); | 78 width, height, stride_y, stride_u, stride_v); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 case kVideoCodecULPFEC: | 210 case kVideoCodecULPFEC: |
211 case kVideoCodecGeneric: | 211 case kVideoCodecGeneric: |
212 case kVideoCodecUnknown: | 212 case kVideoCodecUnknown: |
213 return 0; | 213 return 0; |
214 } | 214 } |
215 RTC_NOTREACHED(); | 215 RTC_NOTREACHED(); |
216 return 0; | 216 return 0; |
217 } | 217 } |
218 | 218 |
219 } // namespace webrtc | 219 } // namespace webrtc |
OLD | NEW |