OLD | NEW |
---|---|
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> | 17 #include <map> |
danilchap
2016/02/17 16:14:00
needed?
pbos-webrtc
2016/02/18 16:00:29
Done.
| |
18 #include <vector> | 18 #include <vector> |
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/scoped_ptr.h" | 22 #include "webrtc/base/scoped_ptr.h" |
danilchap
2016/02/17 16:14:00
not needed too
pbos-webrtc
2016/02/18 16:00:29
Done.
| |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | |
23 #include "webrtc/typedefs.h" | 24 #include "webrtc/typedefs.h" |
24 | 25 |
25 namespace webrtc { | 26 namespace webrtc { |
26 | 27 |
27 class EncoderStateFeedbackObserver; | |
28 class RtcpIntraFrameObserver; | |
29 class ViEEncoder; | 28 class ViEEncoder; |
30 | 29 |
31 class EncoderStateFeedback { | 30 class EncoderStateFeedback : public RtcpIntraFrameObserver { |
32 public: | 31 public: |
33 friend class EncoderStateFeedbackObserver; | |
34 | |
35 EncoderStateFeedback(); | 32 EncoderStateFeedback(); |
36 ~EncoderStateFeedback(); | |
37 | 33 |
38 // Adds an encoder to receive feedback for a set of SSRCs. | 34 // Adds an encoder to receive feedback for a set of SSRCs. |
39 void AddEncoder(const std::vector<uint32_t>& ssrc, ViEEncoder* encoder); | 35 void Init(const std::vector<uint32_t>& ssrc, ViEEncoder* encoder); |
40 | 36 |
41 // Removes a registered ViEEncoder. | 37 // Removes the registered encoder. Necessary while ViEChannel outlives |
danilchap
2016/02/17 16:14:00
may be write is as todo if there are plans to tear
pbos-webrtc
2016/02/18 16:00:29
Rewritten with a TODO.
| |
42 void RemoveEncoder(const ViEEncoder* encoder); | 38 // ViEEncoder. |
39 void TearDown(); | |
43 | 40 |
44 // Returns an observer to register at the requesting class. The observer has | 41 void OnReceivedIntraFrameRequest(uint32_t ssrc) override; |
45 // the same lifetime as the EncoderStateFeedback instance. | 42 void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) override; |
46 RtcpIntraFrameObserver* GetRtcpIntraFrameObserver(); | 43 void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) override; |
47 | 44 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 | 45 |
55 private: | 46 private: |
56 typedef std::map<uint32_t, ViEEncoder*> SsrcEncoderMap; | 47 bool HasSsrc(uint32_t ssrc) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
57 | |
58 rtc::CriticalSection crit_; | 48 rtc::CriticalSection crit_; |
59 | 49 |
60 // Instance registered at the class requesting new key frames. | 50 std::vector<uint32_t> ssrcs_ GUARDED_BY(crit_); |
61 rtc::scoped_ptr<EncoderStateFeedbackObserver> observer_; | 51 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); | |
danilchap
2016/02/17 16:14:00
Doesn't look like EncoderStateFeedback need to be
pbos-webrtc
2016/02/18 16:00:29
Removed the include, I don't think it semantically
danilchap
2016/02/18 17:18:56
Acknowledged.
| |
67 }; | 52 }; |
68 | 53 |
69 } // namespace webrtc | 54 } // namespace webrtc |
70 | 55 |
71 #endif // WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_ | 56 #endif // WEBRTC_VIDEO_ENCODER_STATE_FEEDBACK_H_ |
OLD | NEW |