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

Side by Side Diff: webrtc/media/base/videoframefactory.h

Issue 2017443003: Implement timestamp translation/filter in VideoCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Simplify filter reset. Drop hack to detect if camera time and system time are the same. 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
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
11 #ifndef WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_
12 #define WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ 12 #define WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/common_video/include/i420_buffer_pool.h" 16 #include "webrtc/common_video/include/i420_buffer_pool.h"
17 #include "webrtc/media/base/videoframe.h" 17 #include "webrtc/media/base/videoframe.h"
18 18
19 namespace cricket { 19 namespace cricket {
20 20
21 struct CapturedFrame; 21 struct CapturedFrame;
22 class VideoFrame; 22 class VideoFrame;
23 23
24 // Creates cricket::VideoFrames, or a subclass of cricket::VideoFrame 24 // Creates cricket::VideoFrames, or a subclass of cricket::VideoFrame
25 // depending on the subclass of VideoFrameFactory. 25 // depending on the subclass of VideoFrameFactory.
26 class VideoFrameFactory { 26 class VideoFrameFactory {
27 public: 27 public:
28 VideoFrameFactory() : apply_rotation_(false) {} 28 VideoFrameFactory() : apply_rotation_(false), timestamp_offset_us_(0) {}
29 virtual ~VideoFrameFactory() {} 29 virtual ~VideoFrameFactory() {}
30 30
31 // The returned frame aliases the aliased_frame if the input color 31 // The returned frame aliases the aliased_frame if the input color
32 // space allows for aliasing, otherwise a color conversion will 32 // space allows for aliasing, otherwise a color conversion will
33 // occur. Returns NULL if conversion fails. 33 // occur. Returns NULL if conversion fails.
34 34
35 // The returned frame will be a center crop of |input_frame| with 35 // The returned frame will be a center crop of |input_frame| with
36 // size |cropped_width| x |cropped_height|. 36 // size |cropped_width| x |cropped_height|.
37 virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame, 37 virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame,
38 int cropped_width, 38 int cropped_width,
39 int cropped_height) const = 0; 39 int cropped_height) const = 0;
40 40
41 // The returned frame will be a center crop of |input_frame| with size 41 // The returned frame will be a center crop of |input_frame| with size
42 // |cropped_width| x |cropped_height|, scaled to |output_width| x 42 // |cropped_width| x |cropped_height|, scaled to |output_width| x
43 // |output_height|. 43 // |output_height|.
44 virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame, 44 virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame,
45 int cropped_input_width, 45 int cropped_input_width,
46 int cropped_input_height, 46 int cropped_input_height,
47 int output_width, 47 int output_width,
48 int output_height) const; 48 int output_height) const;
49 49
50 void SetApplyRotation(bool enable) { apply_rotation_ = enable; } 50 void SetApplyRotation(bool enable) { apply_rotation_ = enable; }
51 // TODO(nisse): Delete this method? Not much use in extending this
52 // class, which we'de like to delete.
53 void SetTimestampOffset(int64_t offset) { timestamp_offset_us_ = offset; }
51 54
52 protected: 55 protected:
53 bool apply_rotation_; 56 bool apply_rotation_;
57 // Offset added to the capture timestamp, to translate it to the
58 // system monotonic time attached to the produced VideoFrame.
59 int64_t timestamp_offset_us_;
54 60
55 private: 61 private:
56 // An internal pool to avoid reallocations. It is mutable because it 62 // An internal pool to avoid reallocations. It is mutable because it
57 // does not affect behaviour, only performance. 63 // does not affect behaviour, only performance.
58 mutable webrtc::I420BufferPool pool_; 64 mutable webrtc::I420BufferPool pool_;
59 }; 65 };
60 66
61 } // namespace cricket 67 } // namespace cricket
62 68
63 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ 69 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698