Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: webrtc/common_video/video_frame.cc

Issue 1881933004: Introduce an IsMutable method on VideoFrameBuffer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_->HasOneRef() && 68 if (video_frame_buffer_ && video_frame_buffer_->IsMutable() &&
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 case kVideoCodecULPFEC: 196 case kVideoCodecULPFEC:
197 case kVideoCodecGeneric: 197 case kVideoCodecGeneric:
198 case kVideoCodecUnknown: 198 case kVideoCodecUnknown:
199 return 0; 199 return 0;
200 } 200 }
201 RTC_NOTREACHED(); 201 RTC_NOTREACHED();
202 return 0; 202 return 0;
203 } 203 }
204 204
205 } // namespace webrtc 205 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/include/video_frame_buffer.h ('k') | webrtc/common_video/video_frame_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698