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

Side by Side Diff: webrtc/modules/video_coding/frame_buffer2.h

Issue 1969403007: FrameBuffer for the new jitter buffer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Unittest fix and feedback fixes. Created 4 years, 7 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
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_
13
14 #include <array>
15 #include <map>
16 #include <memory>
17 #include <set>
18 #include <utility>
19
20 #include "webrtc/base/criticalsection.h"
21 #include "webrtc/base/event.h"
22 #include "webrtc/base/thread_annotations.h"
23
24 namespace webrtc {
25
26 class Clock;
27 class VCMJitterEstimator;
28 class VCMTiming;
29
30 namespace video_coding {
31
32 class FrameObject;
33
34 class FrameBuffer {
35 public:
36 FrameBuffer(Clock* clock,
37 VCMJitterEstimator* jitter_estimator,
38 const VCMTiming* timing);
39
40 // Insert a frame into the frame buffer.
41 void InsertFrame(std::unique_ptr<FrameObject> frame);
42
43 // Get the next frame for decoding. Will return at latest after
44 // |max_wait_time_ms|, with either a managed FrameObject or an empty
45 // unique ptr if there is no available frame for decoding.
46 std::unique_ptr<FrameObject> NextFrame(int64_t max_wait_time_ms);
47
48 private:
49 // FrameKey is a pair of (picture id, spatial layer).
50 using FrameKey = std::pair<uint16_t, uint8_t>;
51
52 // Comparator used to sort frames, first on their picture id, and second
53 // on their spatial layer.
54 struct FrameComp {
55 bool operator()(const FrameKey& f1, const FrameKey& f2) const;
56 };
57
58 // Determines whether a frame is continuous.
59 bool IsContinuous(const FrameObject& frame) const
60 EXCLUSIVE_LOCKS_REQUIRED(crit_);
61
62 // Keep track of decoded frames.
63 std::set<FrameKey, FrameComp> decoded_frames_ GUARDED_BY(crit_);
64
65 // The actual buffer that holds the FrameObjects.
66 std::map<FrameKey, std::unique_ptr<FrameObject>, FrameComp> frames_
67 GUARDED_BY(crit_);
68
69 rtc::CriticalSection crit_;
70 Clock* const clock_;
71 rtc::Event frame_inserted_event_;
72 VCMJitterEstimator* const jitter_estimator_;
73 const VCMTiming* const timing_;
74 int newest_picture_id_ GUARDED_BY(crit_);
75 };
danilchap 2016/05/18 11:46:25 you may want include constructormagic.h and use RT
philipel 2016/05/18 12:07:57 Done.
76
77 } // namespace video_coding
78 } // namespace webrtc
79
80 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698