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

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

Issue 1936503002: Removed SSRC knowledge from ViEEncoder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_payload_router2
Patch Set: 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
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
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 bool EncoderStateFeedback::HasSsrc(uint32_t ssrc) { 28 bool EncoderStateFeedback::HasSsrc(uint32_t ssrc) {
29 for (uint32_t registered_ssrc : ssrcs_) { 29 for (uint32_t registered_ssrc : ssrcs_) {
30 if (registered_ssrc == ssrc) 30 if (registered_ssrc == ssrc)
31 return true; 31 return true;
32 } 32 }
33 return false; 33 return false;
34 } 34 }
35 35
36 int EncoderStateFeedback::GetStreamIndex(uint32_t ssrc) {
37 for (size_t i = 0; i < ssrcs_.size(); ++i) {
38 if (ssrcs_[i] == ssrc)
39 return i;
40 }
41 RTC_NOTREACHED() << "Unknown ssrc " << ssrc;
42 return 0;
43 }
44
36 void EncoderStateFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) { 45 void EncoderStateFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) {
37 rtc::CritScope lock(&crit_); 46 rtc::CritScope lock(&crit_);
38 if (!HasSsrc(ssrc)) 47 if (!HasSsrc(ssrc))
39 return; 48 return;
40 RTC_DCHECK(vie_encoder_); 49 RTC_DCHECK(vie_encoder_);
41 50
42 vie_encoder_->OnReceivedIntraFrameRequest(ssrc); 51 vie_encoder_->OnReceivedIntraFrameRequest(GetStreamIndex(ssrc));
43 } 52 }
44 53
45 void EncoderStateFeedback::OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) { 54 void EncoderStateFeedback::OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) {
46 rtc::CritScope lock(&crit_); 55 rtc::CritScope lock(&crit_);
47 if (!HasSsrc(ssrc)) 56 if (!HasSsrc(ssrc))
48 return; 57 return;
49 RTC_DCHECK(vie_encoder_); 58 RTC_DCHECK(vie_encoder_);
50 59
51 vie_encoder_->OnReceivedSLI(ssrc, picture_id); 60 vie_encoder_->OnReceivedSLI(picture_id);
52 } 61 }
53 62
54 void EncoderStateFeedback::OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) { 63 void EncoderStateFeedback::OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) {
55 rtc::CritScope lock(&crit_); 64 rtc::CritScope lock(&crit_);
56 if (!HasSsrc(ssrc)) 65 if (!HasSsrc(ssrc))
57 return; 66 return;
58 RTC_DCHECK(vie_encoder_); 67 RTC_DCHECK(vie_encoder_);
59 68
60 vie_encoder_->OnReceivedRPSI(ssrc, picture_id); 69 vie_encoder_->OnReceivedRPSI(picture_id);
61 } 70 }
62 71
63 // Sending SSRCs for this encoder should never change since they are configured 72 // Sending SSRCs for this encoder should never change since they are configured
64 // once and not reconfigured. 73 // once and not reconfigured.
65 void EncoderStateFeedback::OnLocalSsrcChanged(uint32_t old_ssrc, 74 void EncoderStateFeedback::OnLocalSsrcChanged(uint32_t old_ssrc,
66 uint32_t new_ssrc) { 75 uint32_t new_ssrc) {
67 if (!RTC_DCHECK_IS_ON) 76 if (!RTC_DCHECK_IS_ON)
68 return; 77 return;
69 rtc::CritScope lock(&crit_); 78 rtc::CritScope lock(&crit_);
70 if (ssrcs_.empty()) // Encoder not yet attached (or detached for teardown). 79 if (ssrcs_.empty()) // Encoder not yet attached (or detached for teardown).
71 return; 80 return;
72 // SSRC shouldn't change to something we haven't already registered with the 81 // SSRC shouldn't change to something we haven't already registered with the
73 // encoder. 82 // encoder.
74 RTC_DCHECK(HasSsrc(new_ssrc)); 83 RTC_DCHECK(HasSsrc(new_ssrc));
75 } 84 }
76 85
77 } // namespace webrtc 86 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698