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 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 EncoderStateFeedback::EncoderStateFeedback() | 49 EncoderStateFeedback::EncoderStateFeedback() |
50 : crit_(CriticalSectionWrapper::CreateCriticalSection()), | 50 : crit_(CriticalSectionWrapper::CreateCriticalSection()), |
51 observer_(new EncoderStateFeedbackObserver(this)) {} | 51 observer_(new EncoderStateFeedbackObserver(this)) {} |
52 | 52 |
53 EncoderStateFeedback::~EncoderStateFeedback() { | 53 EncoderStateFeedback::~EncoderStateFeedback() { |
54 assert(encoders_.empty()); | 54 assert(encoders_.empty()); |
55 } | 55 } |
56 | 56 |
57 void EncoderStateFeedback::AddEncoder(const std::vector<uint32_t>& ssrcs, | 57 void EncoderStateFeedback::AddEncoder(const std::vector<uint32_t>& ssrcs, |
58 ViEEncoder* encoder) { | 58 ViEEncoder* encoder) { |
59 DCHECK(!ssrcs.empty()); | 59 RTC_DCHECK(!ssrcs.empty()); |
60 CriticalSectionScoped lock(crit_.get()); | 60 CriticalSectionScoped lock(crit_.get()); |
61 for (uint32_t ssrc : ssrcs) { | 61 for (uint32_t ssrc : ssrcs) { |
62 DCHECK(encoders_.find(ssrc) == encoders_.end()); | 62 RTC_DCHECK(encoders_.find(ssrc) == encoders_.end()); |
63 encoders_[ssrc] = encoder; | 63 encoders_[ssrc] = encoder; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void EncoderStateFeedback::RemoveEncoder(const ViEEncoder* encoder) { | 67 void EncoderStateFeedback::RemoveEncoder(const ViEEncoder* encoder) { |
68 CriticalSectionScoped lock(crit_.get()); | 68 CriticalSectionScoped lock(crit_.get()); |
69 SsrcEncoderMap::iterator it = encoders_.begin(); | 69 SsrcEncoderMap::iterator it = encoders_.begin(); |
70 while (it != encoders_.end()) { | 70 while (it != encoders_.end()) { |
71 if (it->second == encoder) { | 71 if (it->second == encoder) { |
72 encoders_.erase(it++); | 72 encoders_.erase(it++); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return; | 115 return; |
116 } | 116 } |
117 | 117 |
118 ViEEncoder* encoder = it->second; | 118 ViEEncoder* encoder = it->second; |
119 encoders_.erase(it); | 119 encoders_.erase(it); |
120 encoders_[new_ssrc] = encoder; | 120 encoders_[new_ssrc] = encoder; |
121 encoder->OnLocalSsrcChanged(old_ssrc, new_ssrc); | 121 encoder->OnLocalSsrcChanged(old_ssrc, new_ssrc); |
122 } | 122 } |
123 | 123 |
124 } // namespace webrtc | 124 } // namespace webrtc |
OLD | NEW |