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

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

Issue 2357113002: Revert of Delete VideoFrameFactory, CapturedFrame, and related code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 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/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoframe.cc » ('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;
26
25 // TODO(nisse): This class will be deleted when the cricket::VideoFrame and 27 // TODO(nisse): This class will be deleted when the cricket::VideoFrame and
26 // webrtc::VideoFrame classes are merged. See 28 // webrtc::VideoFrame classes are merged. See
27 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5682. Try to use only the 29 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5682. Try to use only the
28 // preferred constructor, and the non-deprecated methods of the VideoFrame base 30 // preferred constructor, and the non-deprecated methods of the VideoFrame base
29 // class. 31 // class.
30 class WebRtcVideoFrame : public VideoFrame { 32 class WebRtcVideoFrame : public VideoFrame {
31 public: 33 public:
32 // TODO(nisse): Deprecated. Using the default constructor violates the 34 // TODO(nisse): Deprecated. Using the default constructor violates the
33 // reasonable assumption that video_frame_buffer() returns a valid buffer. 35 // reasonable assumption that video_frame_buffer() returns a valid buffer.
34 WebRtcVideoFrame(); 36 WebRtcVideoFrame();
(...skipping 11 matching lines...) Expand all
46 int64_t timestamp_us); 48 int64_t timestamp_us);
47 49
48 // TODO(nisse): Deprecated, delete as soon as all callers have switched to the 50 // TODO(nisse): Deprecated, delete as soon as all callers have switched to the
49 // above constructor with microsecond timestamp. 51 // above constructor with microsecond timestamp.
50 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, 52 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
51 int64_t timestamp_ns, 53 int64_t timestamp_ns,
52 webrtc::VideoRotation rotation); 54 webrtc::VideoRotation rotation);
53 55
54 ~WebRtcVideoFrame(); 56 ~WebRtcVideoFrame();
55 57
56 // TODO(nisse): Init (and its helpers Reset and Validate) are used
57 // only by the LoadFrame function used in the VideoFrame unittests.
58 // Rewrite tests, and delete this function.
59
60 // Creates a frame from a raw sample with FourCC "format" and size "w" x "h". 58 // Creates a frame from a raw sample with FourCC "format" and size "w" x "h".
61 // "h" can be negative indicating a vertically flipped image. 59 // "h" can be negative indicating a vertically flipped image.
62 // "dh" is destination height if cropping is desired and is always positive. 60 // "dh" is destination height if cropping is desired and is always positive.
63 // Returns "true" if successful. 61 // Returns "true" if successful.
64 bool Init(uint32_t format, 62 bool Init(uint32_t format,
65 int w, 63 int w,
66 int h, 64 int h,
67 int dw, 65 int dw,
68 int dh, 66 int dh,
69 uint8_t* sample, 67 uint8_t* sample,
70 size_t sample_size, 68 size_t sample_size,
71 int64_t timestamp_ns, 69 int64_t timestamp_ns,
72 webrtc::VideoRotation rotation); 70 webrtc::VideoRotation rotation);
73 71
72 // TODO(nisse): We're moving to have all timestamps use the same
73 // time scale as rtc::TimeMicros. However, this method is used by
74 // WebRtcVideoFrameFactory::CreateAliasedFrame this code path
75 // currently does not conform to the new timestamp conventions and
76 // may use the camera's own clock instead. It's unclear if this
77 // should be fixed, or if instead all of the VideoFrameFactory
78 // abstraction should be eliminated.
79 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation);
80
74 void InitToEmptyBuffer(int w, int h); 81 void InitToEmptyBuffer(int w, int h);
75 82
76 int width() const override; 83 int width() const override;
77 int height() const override; 84 int height() const override;
78 85
79 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer() 86 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer()
80 const override; 87 const override;
81 88
82 uint32_t transport_frame_id() const override; 89 uint32_t transport_frame_id() const override;
83 90
(...skipping 30 matching lines...) Expand all
114 webrtc::VideoRotation rotation_; 121 webrtc::VideoRotation rotation_;
115 122
116 // This is mutable as the calculation is expensive but once calculated, it 123 // This is mutable as the calculation is expensive but once calculated, it
117 // remains const. 124 // remains const.
118 mutable std::unique_ptr<VideoFrame> rotated_frame_; 125 mutable std::unique_ptr<VideoFrame> rotated_frame_;
119 }; 126 };
120 127
121 } // namespace cricket 128 } // namespace cricket
122 129
123 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_ 130 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoframe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698