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

Side by Side Diff: webrtc/video/encoder_rtcp_feedback.cc

Issue 2390463002: Remove OnLocalSsrcChanged and rename EncoderStateFeedback. (Closed)
Patch Set: Rebase Created 4 years, 2 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 | « webrtc/video/encoder_rtcp_feedback.h ('k') | webrtc/video/encoder_rtcp_feedback_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 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 #include "webrtc/video/encoder_rtcp_feedback.h"
12
13 #include "webrtc/base/checks.h"
14 #include "webrtc/video/vie_encoder.h"
15
16 static const int kMinKeyFrameRequestIntervalMs = 300;
17
18 namespace webrtc {
19
20 EncoderRtcpFeedback::EncoderRtcpFeedback(Clock* clock,
21 const std::vector<uint32_t>& ssrcs,
22 ViEEncoder* encoder)
23 : clock_(clock),
24 ssrcs_(ssrcs),
25 vie_encoder_(encoder),
26 time_last_intra_request_ms_(ssrcs.size(), -1) {
27 RTC_DCHECK(!ssrcs.empty());
28 }
29
30 bool EncoderRtcpFeedback::HasSsrc(uint32_t ssrc) {
31 for (uint32_t registered_ssrc : ssrcs_) {
32 if (registered_ssrc == ssrc) {
33 return true;
34 }
35 }
36 return false;
37 }
38
39 size_t EncoderRtcpFeedback::GetStreamIndex(uint32_t ssrc) {
40 for (size_t i = 0; i < ssrcs_.size(); ++i) {
41 if (ssrcs_[i] == ssrc)
42 return i;
43 }
44 RTC_NOTREACHED() << "Unknown ssrc " << ssrc;
45 return 0;
46 }
47
48 void EncoderRtcpFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) {
49 RTC_DCHECK(HasSsrc(ssrc));
50 size_t index = GetStreamIndex(ssrc);
51 {
52 // TODO(mflodman): Move to ViEEncoder after some more changes making it
53 // easier to test there.
54 int64_t now_ms = clock_->TimeInMilliseconds();
55 rtc::CritScope lock(&crit_);
56 if (time_last_intra_request_ms_[index] + kMinKeyFrameRequestIntervalMs >
57 now_ms) {
58 return;
59 }
60 time_last_intra_request_ms_[index] = now_ms;
61 }
62
63 vie_encoder_->OnReceivedIntraFrameRequest(index);
64 }
65
66 void EncoderRtcpFeedback::OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) {
67 RTC_DCHECK(HasSsrc(ssrc));
68
69 vie_encoder_->OnReceivedSLI(picture_id);
70 }
71
72 void EncoderRtcpFeedback::OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) {
73 RTC_DCHECK(HasSsrc(ssrc));
74
75 vie_encoder_->OnReceivedRPSI(picture_id);
76 }
77 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/encoder_rtcp_feedback.h ('k') | webrtc/video/encoder_rtcp_feedback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698