Chromium Code Reviews| 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" | |
| 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 |
| 43 // Insert a frame into the frame buffer. | 44 // Insert a frame into the frame buffer. |
| 44 void InsertFrame(std::unique_ptr<FrameObject> frame); | 45 void InsertFrame(std::unique_ptr<FrameObject> frame); |
| 45 | 46 |
| 46 // Get the next frame for decoding. Will return at latest after | 47 // Get the next frame for decoding. Will return at latest after |
| 47 // |max_wait_time_ms|, with either a managed FrameObject or an empty | 48 // |max_wait_time_ms|. |
| 48 // unique ptr if there is no available frame for decoding. | 49 // - 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); | 50 // an optional with a pointer to the frame. |
| 51 // - If no frame is available after |max_wait_time_ms| it will return | |
| 52 // an optional with a nullptr value. | |
| 53 // - If the FrameBuffer is stopped then it will return an optional | |
|
danilchap
2016/08/31 15:04:36
I do not think rtc::Optional is a good tool to ret
philipel
2016/09/01 09:25:23
I'm not sure I understand why rtc::Optional is the
danilchap
2016/09/01 09:44:09
You have three possible outcomes for this function
| |
| 54 // without a value. | |
| 55 rtc::Optional<std::unique_ptr<FrameObject>> | |
| 56 NextFrame(int64_t max_wait_time_ms); | |
| 50 | 57 |
| 51 // Tells the FrameBuffer which protection mode that is in use. Affects | 58 // Tells the FrameBuffer which protection mode that is in use. Affects |
| 52 // the frame timing. | 59 // the frame timing. |
| 53 // TODO(philipel): Remove this when new timing calculations has been | 60 // TODO(philipel): Remove this when new timing calculations has been |
| 54 // implemented. | 61 // implemented. |
| 55 void SetProtectionMode(VCMVideoProtection mode); | 62 void SetProtectionMode(VCMVideoProtection mode); |
| 56 | 63 |
| 57 // Start the frame buffer, has no effect if the frame buffer is started. | 64 // Start the frame buffer, has no effect if the frame buffer is started. |
| 58 // The frame buffer is started upon construction. | 65 // The frame buffer is started upon construction. |
| 59 void Start(); | 66 void Start(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 bool stopped_ GUARDED_BY(crit_); | 100 bool stopped_ GUARDED_BY(crit_); |
| 94 VCMVideoProtection protection_mode_ GUARDED_BY(crit_); | 101 VCMVideoProtection protection_mode_ GUARDED_BY(crit_); |
| 95 | 102 |
| 96 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); | 103 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); |
| 97 }; | 104 }; |
| 98 | 105 |
| 99 } // namespace video_coding | 106 } // namespace video_coding |
| 100 } // namespace webrtc | 107 } // namespace webrtc |
| 101 | 108 |
| 102 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ | 109 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ |
| OLD | NEW |