OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 10 matching lines...) Expand all Loading... |
21 // Base class for sources which needs video adaptation, e.g., video | 21 // Base class for sources which needs video adaptation, e.g., video |
22 // capture sources. Sinks must be added and removed on one and only | 22 // capture sources. Sinks must be added and removed on one and only |
23 // one thread, while AdaptFrame and OnFrame may be called on any | 23 // one thread, while AdaptFrame and OnFrame may be called on any |
24 // thread. | 24 // thread. |
25 class AdaptedVideoTrackSource | 25 class AdaptedVideoTrackSource |
26 : public webrtc::Notifier<webrtc::VideoTrackSourceInterface> { | 26 : public webrtc::Notifier<webrtc::VideoTrackSourceInterface> { |
27 public: | 27 public: |
28 AdaptedVideoTrackSource(); | 28 AdaptedVideoTrackSource(); |
29 | 29 |
30 protected: | 30 protected: |
31 // Allows derived classes to initialize |video_adapter_| with a custom | |
32 // alignment. | |
33 AdaptedVideoTrackSource(int required_alignment); | |
34 // Checks the apply_rotation() flag. If the frame needs rotation, and it is a | 31 // Checks the apply_rotation() flag. If the frame needs rotation, and it is a |
35 // plain memory frame, it is rotated. Subclasses producing native frames must | 32 // plain memory frame, it is rotated. Subclasses producing native frames must |
36 // handle apply_rotation() themselves. | 33 // handle apply_rotation() themselves. |
37 void OnFrame(const webrtc::VideoFrame& frame); | 34 void OnFrame(const webrtc::VideoFrame& frame); |
38 | 35 |
39 // Reports the appropriate frame size after adaptation. Returns true | 36 // Reports the appropriate frame size after adaptation. Returns true |
40 // if a frame is wanted. Returns false if there are no interested | 37 // if a frame is wanted. Returns false if there are no interested |
41 // sinks, or if the VideoAdapter decides to drop the frame. | 38 // sinks, or if the VideoAdapter decides to drop the frame. |
42 bool AdaptFrame(int width, | 39 bool AdaptFrame(int width, |
43 int height, | 40 int height, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 72 |
76 rtc::CriticalSection stats_crit_; | 73 rtc::CriticalSection stats_crit_; |
77 rtc::Optional<Stats> stats_ GUARDED_BY(stats_crit_); | 74 rtc::Optional<Stats> stats_ GUARDED_BY(stats_crit_); |
78 | 75 |
79 VideoBroadcaster broadcaster_; | 76 VideoBroadcaster broadcaster_; |
80 }; | 77 }; |
81 | 78 |
82 } // namespace rtc | 79 } // namespace rtc |
83 | 80 |
84 #endif // WEBRTC_MEDIA_BASE_ADAPTEDVIDEOTRACKSOURCE_H_ | 81 #endif // WEBRTC_MEDIA_BASE_ADAPTEDVIDEOTRACKSOURCE_H_ |
OLD | NEW |