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 |
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ |
13 | 13 |
14 #include <array> | 14 #include <array> |
15 #include <map> | 15 #include <map> |
16 #include <memory> | 16 #include <memory> |
17 #include <set> | 17 #include <set> |
18 #include <utility> | 18 #include <utility> |
19 | 19 |
20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/base/criticalsection.h" | 21 #include "webrtc/base/criticalsection.h" |
22 #include "webrtc/base/event.h" | 22 #include "webrtc/base/event.h" |
23 #include "webrtc/base/optional.h" | |
danilchap
2016/09/01 11:15:21
not needed
philipel
2016/09/01 11:38:02
Done.
| |
23 #include "webrtc/base/thread_annotations.h" | 24 #include "webrtc/base/thread_annotations.h" |
24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 25 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
25 #include "webrtc/modules/video_coding/inter_frame_delay.h" | 26 #include "webrtc/modules/video_coding/inter_frame_delay.h" |
26 | 27 |
27 namespace webrtc { | 28 namespace webrtc { |
28 | 29 |
29 class Clock; | 30 class Clock; |
30 class VCMJitterEstimator; | 31 class VCMJitterEstimator; |
31 class VCMTiming; | 32 class VCMTiming; |
32 | 33 |
33 namespace video_coding { | 34 namespace video_coding { |
34 | 35 |
35 class FrameObject; | 36 class FrameObject; |
36 | 37 |
37 class FrameBuffer { | 38 class FrameBuffer { |
38 public: | 39 public: |
39 FrameBuffer(Clock* clock, | 40 FrameBuffer(Clock* clock, |
40 VCMJitterEstimator* jitter_estimator, | 41 VCMJitterEstimator* jitter_estimator, |
41 VCMTiming* timing); | 42 VCMTiming* timing); |
42 | 43 |
44 enum ReturnReason { | |
danilchap
2016/09/01 11:15:21
enum should go before constructor.
Probably make i
philipel
2016/09/01 11:38:03
Acknowledged.
| |
45 kFrameFound, | |
danilchap
2016/09/01 11:15:21
if you choose FrameStatus for the enum type, then
philipel
2016/09/01 11:38:03
Acknowledged.
| |
46 kTimeout, | |
47 kStopped | |
48 }; | |
49 | |
43 // Insert a frame into the frame buffer. | 50 // Insert a frame into the frame buffer. |
44 void InsertFrame(std::unique_ptr<FrameObject> frame); | 51 void InsertFrame(std::unique_ptr<FrameObject> frame); |
45 | 52 |
46 // Get the next frame for decoding. Will return at latest after | 53 // Get the next frame for decoding. Will return at latest after |
47 // |max_wait_time_ms|, with either a managed FrameObject or an empty | 54 // |max_wait_time_ms|. |
48 // unique ptr if there is no available frame for decoding. | 55 // - If a frame is availiable within |max_wait_time_ms| it will return |
49 std::unique_ptr<FrameObject> NextFrame(int64_t max_wait_time_ms); | 56 // {kFrameFound, non-null unique ptr} |
57 // - If no frame is available after |max_wait_time_ms| it will return | |
58 // {kTimeout, null unique ptr} | |
59 // - If the FrameBuffer is stopped then it will return | |
60 // {kStopped, null unique ptr} | |
61 std::pair<ReturnReason, std::unique_ptr<FrameObject>> | |
danilchap
2016/09/01 11:15:21
in stl it is more often when a pair<object, status
| |
62 NextFrame(int64_t max_wait_time_ms); | |
50 | 63 |
51 // Tells the FrameBuffer which protection mode that is in use. Affects | 64 // Tells the FrameBuffer which protection mode that is in use. Affects |
52 // the frame timing. | 65 // the frame timing. |
53 // TODO(philipel): Remove this when new timing calculations has been | 66 // TODO(philipel): Remove this when new timing calculations has been |
54 // implemented. | 67 // implemented. |
55 void SetProtectionMode(VCMVideoProtection mode); | 68 void SetProtectionMode(VCMVideoProtection mode); |
56 | 69 |
57 // Start the frame buffer, has no effect if the frame buffer is started. | 70 // Start the frame buffer, has no effect if the frame buffer is started. |
58 // The frame buffer is started upon construction. | 71 // The frame buffer is started upon construction. |
59 void Start(); | 72 void Start(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 bool stopped_ GUARDED_BY(crit_); | 106 bool stopped_ GUARDED_BY(crit_); |
94 VCMVideoProtection protection_mode_ GUARDED_BY(crit_); | 107 VCMVideoProtection protection_mode_ GUARDED_BY(crit_); |
95 | 108 |
96 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); | 109 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); |
97 }; | 110 }; |
98 | 111 |
99 } // namespace video_coding | 112 } // namespace video_coding |
100 } // namespace webrtc | 113 } // namespace webrtc |
101 | 114 |
102 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ | 115 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ |
OLD | NEW |