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

Side by Side Diff: webrtc/video_frame.h

Issue 2477233004: Update VideoFrameBuffer-related methods to not use references to scoped_refptr. (Closed)
Patch Set: Fix memory leak. Created 4 years, 1 month 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // only if the object was default-constructed. 113 // only if the object was default-constructed.
114 // TODO(nisse): Deprecated. Should be deleted in the cricket::VideoFrame and 114 // TODO(nisse): Deprecated. Should be deleted in the cricket::VideoFrame and
115 // webrtc::VideoFrame merge. The intention is that video_frame_buffer() never 115 // webrtc::VideoFrame merge. The intention is that video_frame_buffer() never
116 // should return nullptr. To handle potentially uninitialized or non-existent 116 // should return nullptr. To handle potentially uninitialized or non-existent
117 // frames, consider using rtc::Optional. Otherwise, IsZeroSize() can be 117 // frames, consider using rtc::Optional. Otherwise, IsZeroSize() can be
118 // replaced by video_frame_buffer() == nullptr. 118 // replaced by video_frame_buffer() == nullptr.
119 bool IsZeroSize() const; 119 bool IsZeroSize() const;
120 120
121 // Return the underlying buffer. Never nullptr for a properly 121 // Return the underlying buffer. Never nullptr for a properly
122 // initialized VideoFrame. 122 // initialized VideoFrame.
123 // Creating a new reference breaks the HasOneRef and IsMutable 123 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const;
124 // logic. So return a const ref to our reference.
125 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer()
126 const;
127 124
128 // Return true if the frame is stored in a texture. 125 // Return true if the frame is stored in a texture.
129 bool is_texture() const { 126 bool is_texture() const {
130 return video_frame_buffer() && 127 return video_frame_buffer() &&
131 video_frame_buffer()->native_handle() != nullptr; 128 video_frame_buffer()->native_handle() != nullptr;
132 } 129 }
133 130
134 private: 131 private:
135 // An opaque reference counted handle that stores the pixel data. 132 // An opaque reference counted handle that stores the pixel data.
136 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; 133 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 int qp_ = -1; // Quantizer value. 180 int qp_ = -1; // Quantizer value.
184 181
185 // When an application indicates non-zero values here, it is taken as an 182 // When an application indicates non-zero values here, it is taken as an
186 // indication that all future frames will be constrained with those limits 183 // indication that all future frames will be constrained with those limits
187 // until the application indicates a change again. 184 // until the application indicates a change again.
188 PlayoutDelay playout_delay_ = {-1, -1}; 185 PlayoutDelay playout_delay_ = {-1, -1};
189 }; 186 };
190 187
191 } // namespace webrtc 188 } // namespace webrtc
192 #endif // WEBRTC_VIDEO_FRAME_H_ 189 #endif // WEBRTC_VIDEO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698