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

Side by Side Diff: webrtc/media/engine/webrtcvideoframe.h

Issue 2088193002: Add TODO comments on deprecated VideoFrame methods. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Provide per-method advice for deprecated methods. Created 4 years, 6 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
« no previous file with comments | « webrtc/media/base/videoframe.h ('k') | webrtc/video_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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
11 #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_ 11 #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_
12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_ 12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/base/buffer.h" 16 #include "webrtc/base/buffer.h"
17 #include "webrtc/base/refcount.h" 17 #include "webrtc/base/refcount.h"
18 #include "webrtc/base/scoped_ref_ptr.h" 18 #include "webrtc/base/scoped_ref_ptr.h"
19 #include "webrtc/common_types.h" 19 #include "webrtc/common_types.h"
20 #include "webrtc/common_video/include/video_frame_buffer.h" 20 #include "webrtc/common_video/include/video_frame_buffer.h"
21 #include "webrtc/media/base/videoframe.h" 21 #include "webrtc/media/base/videoframe.h"
22 22
23 namespace cricket { 23 namespace cricket {
24 24
25 struct CapturedFrame; 25 struct CapturedFrame;
26 26
27 // TODO(nisse): This class will be deleted when the cricket::VideoFrame and
28 // webrtc::VideoFrame classes are merged. See
29 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5682. Try to use only the
30 // preferred constructor, and the non-deprecated methods of the VideoFrame base
31 // class.
27 class WebRtcVideoFrame : public VideoFrame { 32 class WebRtcVideoFrame : public VideoFrame {
28 public: 33 public:
34 // TODO(nisse): Deprecated. Using the default constructor violates the
35 // reasonable assumption that video_frame_buffer() returns a valid buffer.
29 WebRtcVideoFrame(); 36 WebRtcVideoFrame();
30 37
31 // Preferred construction, with microsecond timestamp. 38 // Preferred constructor.
32 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, 39 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
33 webrtc::VideoRotation rotation, 40 webrtc::VideoRotation rotation,
34 int64_t timestamp_us); 41 int64_t timestamp_us);
35 42
36 // TODO(nisse): Deprecate/delete. 43 // TODO(nisse): Deprecated, delete as soon as all callers have switched to the
44 // above constructor with microsecond timestamp.
37 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, 45 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
38 int64_t time_stamp_ns, 46 int64_t time_stamp_ns,
39 webrtc::VideoRotation rotation); 47 webrtc::VideoRotation rotation);
40 48
41 ~WebRtcVideoFrame(); 49 ~WebRtcVideoFrame();
42 50
43 // Creates a frame from a raw sample with FourCC "format" and size "w" x "h". 51 // Creates a frame from a raw sample with FourCC "format" and size "w" x "h".
44 // "h" can be negative indicating a vertically flipped image. 52 // "h" can be negative indicating a vertically flipped image.
45 // "dh" is destination height if cropping is desired and is always positive. 53 // "dh" is destination height if cropping is desired and is always positive.
46 // Returns "true" if successful. 54 // Returns "true" if successful.
47 bool Init(uint32_t format, 55 bool Init(uint32_t format,
48 int w, 56 int w,
49 int h, 57 int h,
50 int dw, 58 int dw,
51 int dh, 59 int dh,
52 uint8_t* sample, 60 uint8_t* sample,
53 size_t sample_size, 61 size_t sample_size,
54 int64_t time_stamp_ns, 62 int64_t time_stamp_ns,
55 webrtc::VideoRotation rotation); 63 webrtc::VideoRotation rotation);
56 64
57 // The timestamp of the captured frame is expected to use the same 65 // TODO(nisse): We're moving to have all timestamps use the same
58 // timescale and epoch as rtc::Time. 66 // time scale as rtc::TimeMicros. However, this method is used by
59 // TODO(nisse): Consider adding a warning message, or even an RTC_DCHECK, if 67 // WebRtcVideoFrameFactory::CreateAliasedFrame this code path
60 // the time is too far off. 68 // currently does not conform to the new timestamp conventions and
69 // may use the camera's own clock instead. It's unclear if this
70 // should be fixed, or if instead all of the VideoFrameFactory
71 // abstraction should be eliminated.
61 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); 72 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation);
62 73
63 void InitToEmptyBuffer(int w, int h); 74 void InitToEmptyBuffer(int w, int h);
64 void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns); 75 void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns);
65 76
66 int width() const override; 77 int width() const override;
67 int height() const override; 78 int height() const override;
68 79
69 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer() 80 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer()
70 const override; 81 const override;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 webrtc::VideoRotation rotation_; 125 webrtc::VideoRotation rotation_;
115 126
116 // This is mutable as the calculation is expensive but once calculated, it 127 // This is mutable as the calculation is expensive but once calculated, it
117 // remains const. 128 // remains const.
118 mutable std::unique_ptr<VideoFrame> rotated_frame_; 129 mutable std::unique_ptr<VideoFrame> rotated_frame_;
119 }; 130 };
120 131
121 } // namespace cricket 132 } // namespace cricket
122 133
123 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_ 134 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/videoframe.h ('k') | webrtc/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698