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

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

Issue 2995433002: Rename ViEEncoder to VideoStreamEncoder. (Closed)
Patch Set: Created 3 years, 4 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
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 #include "webrtc/video/encoder_rtcp_feedback.h" 11 #include "webrtc/video/encoder_rtcp_feedback.h"
12 12
13 #include "webrtc/rtc_base/checks.h" 13 #include "webrtc/rtc_base/checks.h"
14 #include "webrtc/video/vie_encoder.h" 14 #include "webrtc/video/video_stream_encoder.h"
15 15
16 static const int kMinKeyFrameRequestIntervalMs = 300; 16 static const int kMinKeyFrameRequestIntervalMs = 300;
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 EncoderRtcpFeedback::EncoderRtcpFeedback(Clock* clock, 20 EncoderRtcpFeedback::EncoderRtcpFeedback(Clock* clock,
21 const std::vector<uint32_t>& ssrcs, 21 const std::vector<uint32_t>& ssrcs,
22 ViEEncoder* encoder) 22 VideoStreamEncoder* encoder)
23 : clock_(clock), 23 : clock_(clock),
24 ssrcs_(ssrcs), 24 ssrcs_(ssrcs),
25 vie_encoder_(encoder), 25 video_stream_encoder_(encoder),
26 time_last_intra_request_ms_(ssrcs.size(), -1) { 26 time_last_intra_request_ms_(ssrcs.size(), -1) {
27 RTC_DCHECK(!ssrcs.empty()); 27 RTC_DCHECK(!ssrcs.empty());
28 } 28 }
29 29
30 bool EncoderRtcpFeedback::HasSsrc(uint32_t ssrc) { 30 bool EncoderRtcpFeedback::HasSsrc(uint32_t ssrc) {
31 for (uint32_t registered_ssrc : ssrcs_) { 31 for (uint32_t registered_ssrc : ssrcs_) {
32 if (registered_ssrc == ssrc) { 32 if (registered_ssrc == ssrc) {
33 return true; 33 return true;
34 } 34 }
35 } 35 }
36 return false; 36 return false;
37 } 37 }
38 38
39 size_t EncoderRtcpFeedback::GetStreamIndex(uint32_t ssrc) { 39 size_t EncoderRtcpFeedback::GetStreamIndex(uint32_t ssrc) {
40 for (size_t i = 0; i < ssrcs_.size(); ++i) { 40 for (size_t i = 0; i < ssrcs_.size(); ++i) {
41 if (ssrcs_[i] == ssrc) 41 if (ssrcs_[i] == ssrc)
42 return i; 42 return i;
43 } 43 }
44 RTC_NOTREACHED() << "Unknown ssrc " << ssrc; 44 RTC_NOTREACHED() << "Unknown ssrc " << ssrc;
45 return 0; 45 return 0;
46 } 46 }
47 47
48 void EncoderRtcpFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) { 48 void EncoderRtcpFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) {
49 RTC_DCHECK(HasSsrc(ssrc)); 49 RTC_DCHECK(HasSsrc(ssrc));
50 size_t index = GetStreamIndex(ssrc); 50 size_t index = GetStreamIndex(ssrc);
51 { 51 {
52 // TODO(mflodman): Move to ViEEncoder after some more changes making it 52 // TODO(mflodman): Move to VideoStreamEncoder after some more changes making
53 // easier to test there. 53 // it easier to test there.
54 int64_t now_ms = clock_->TimeInMilliseconds(); 54 int64_t now_ms = clock_->TimeInMilliseconds();
55 rtc::CritScope lock(&crit_); 55 rtc::CritScope lock(&crit_);
56 if (time_last_intra_request_ms_[index] + kMinKeyFrameRequestIntervalMs > 56 if (time_last_intra_request_ms_[index] + kMinKeyFrameRequestIntervalMs >
57 now_ms) { 57 now_ms) {
58 return; 58 return;
59 } 59 }
60 time_last_intra_request_ms_[index] = now_ms; 60 time_last_intra_request_ms_[index] = now_ms;
61 } 61 }
62 62
63 vie_encoder_->OnReceivedIntraFrameRequest(index); 63 video_stream_encoder_->OnReceivedIntraFrameRequest(index);
64 } 64 }
65 65
66 } // namespace webrtc 66 } // 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