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

Side by Side Diff: webrtc/video/encoder_state_feedback.h

Issue 1706803002: Simplify EncoderStateFeedback. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove unused headers Created 4 years, 10 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
« no previous file with comments | « no previous file | webrtc/video/encoder_state_feedback.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 // TODO(mflodman) ViEEncoder has a time check to not send key frames too often, 11 // TODO(mflodman) ViEEncoder has a time check to not send key frames too often,
12 // move the logic to this class. 12 // move the logic to this class.
13 13
14 #ifndef WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_ 14 #ifndef WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_
15 #define WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_ 15 #define WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_
16 16
17 #include <map>
18 #include <vector> 17 #include <vector>
19 18
20 #include "webrtc/base/constructormagic.h"
21 #include "webrtc/base/criticalsection.h" 19 #include "webrtc/base/criticalsection.h"
22 #include "webrtc/base/scoped_ptr.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
23 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
24 22
25 namespace webrtc { 23 namespace webrtc {
26 24
27 class EncoderStateFeedbackObserver;
28 class RtcpIntraFrameObserver;
29 class ViEEncoder; 25 class ViEEncoder;
30 26
31 class EncoderStateFeedback { 27 class EncoderStateFeedback : public RtcpIntraFrameObserver {
32 public: 28 public:
33 friend class EncoderStateFeedbackObserver;
34
35 EncoderStateFeedback(); 29 EncoderStateFeedback();
36 ~EncoderStateFeedback();
37 30
38 // Adds an encoder to receive feedback for a set of SSRCs. 31 // Adds an encoder to receive feedback for a set of SSRCs.
39 void AddEncoder(const std::vector<uint32_t>& ssrc, ViEEncoder* encoder); 32 void Init(const std::vector<uint32_t>& ssrc, ViEEncoder* encoder);
40 33
41 // Removes a registered ViEEncoder. 34 // Removes the registered encoder. Necessary since RTP modules outlive
42 void RemoveEncoder(const ViEEncoder* encoder); 35 // ViEEncoder.
36 // TODO(pbos): Make sure RTP modules are not running when tearing down
37 // ViEEncoder, then remove this function.
38 void TearDown();
43 39
44 // Returns an observer to register at the requesting class. The observer has 40 void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
45 // the same lifetime as the EncoderStateFeedback instance. 41 void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) override;
46 RtcpIntraFrameObserver* GetRtcpIntraFrameObserver(); 42 void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) override;
47 43 void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) override;
48 protected:
49 // Called by EncoderStateFeedbackObserver when a new key frame is requested.
50 void OnReceivedIntraFrameRequest(uint32_t ssrc);
51 void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id);
52 void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id);
53 void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc);
54 44
55 private: 45 private:
56 typedef std::map<uint32_t, ViEEncoder*> SsrcEncoderMap; 46 bool HasSsrc(uint32_t ssrc) EXCLUSIVE_LOCKS_REQUIRED(crit_);
57
58 rtc::CriticalSection crit_; 47 rtc::CriticalSection crit_;
59 48
60 // Instance registered at the class requesting new key frames. 49 std::vector<uint32_t> ssrcs_ GUARDED_BY(crit_);
61 rtc::scoped_ptr<EncoderStateFeedbackObserver> observer_; 50 ViEEncoder* vie_encoder_ GUARDED_BY(crit_);
62
63 // Maps a unique ssrc to the given encoder.
64 SsrcEncoderMap encoders_;
65
66 RTC_DISALLOW_COPY_AND_ASSIGN(EncoderStateFeedback);
67 }; 51 };
68 52
69 } // namespace webrtc 53 } // namespace webrtc
70 54
71 #endif // WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_ 55 #endif // WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/encoder_state_feedback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698