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

Unified Diff: webrtc/video_engine/encoder_state_feedback.cc

Issue 1510183002: Reland of Merge webrtc/video_engine/ into webrtc/video/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/video_engine/encoder_state_feedback.cc
diff --git a/webrtc/video_engine/encoder_state_feedback.cc b/webrtc/video_engine/encoder_state_feedback.cc
deleted file mode 100644
index 16ee8b95fc37a5e39580f77283eb445a509bff33..0000000000000000000000000000000000000000
--- a/webrtc/video_engine/encoder_state_feedback.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "webrtc/video_engine/encoder_state_feedback.h"
-
-#include <assert.h>
-
-#include "webrtc/base/checks.h"
-#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
-#include "webrtc/video_engine/vie_encoder.h"
-
-namespace webrtc {
-
-// Helper class registered at the RTP module relaying callbacks to
-// EncoderStatFeedback.
-class EncoderStateFeedbackObserver : public RtcpIntraFrameObserver {
- public:
- explicit EncoderStateFeedbackObserver(EncoderStateFeedback* owner)
- : owner_(owner) {}
- ~EncoderStateFeedbackObserver() {}
-
- // Implements RtcpIntraFrameObserver.
- virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) {
- owner_->OnReceivedIntraFrameRequest(ssrc);
- }
- virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) {
- owner_->OnReceivedSLI(ssrc, picture_id);
- }
- virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) {
- owner_->OnReceivedRPSI(ssrc, picture_id);
- }
-
- virtual void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) {
- owner_->OnLocalSsrcChanged(old_ssrc, new_ssrc);
- }
-
- private:
- EncoderStateFeedback* owner_;
-};
-
-EncoderStateFeedback::EncoderStateFeedback()
- : crit_(CriticalSectionWrapper::CreateCriticalSection()),
- observer_(new EncoderStateFeedbackObserver(this)) {}
-
-EncoderStateFeedback::~EncoderStateFeedback() {
- assert(encoders_.empty());
-}
-
-void EncoderStateFeedback::AddEncoder(const std::vector<uint32_t>& ssrcs,
- ViEEncoder* encoder) {
- RTC_DCHECK(!ssrcs.empty());
- CriticalSectionScoped lock(crit_.get());
- for (uint32_t ssrc : ssrcs) {
- RTC_DCHECK(encoders_.find(ssrc) == encoders_.end());
- encoders_[ssrc] = encoder;
- }
-}
-
-void EncoderStateFeedback::RemoveEncoder(const ViEEncoder* encoder) {
- CriticalSectionScoped lock(crit_.get());
- SsrcEncoderMap::iterator it = encoders_.begin();
- while (it != encoders_.end()) {
- if (it->second == encoder) {
- encoders_.erase(it++);
- } else {
- ++it;
- }
- }
-}
-
-RtcpIntraFrameObserver* EncoderStateFeedback::GetRtcpIntraFrameObserver() {
- return observer_.get();
-}
-
-void EncoderStateFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) {
- CriticalSectionScoped lock(crit_.get());
- SsrcEncoderMap::iterator it = encoders_.find(ssrc);
- if (it == encoders_.end())
- return;
-
- it->second->OnReceivedIntraFrameRequest(ssrc);
-}
-
-void EncoderStateFeedback::OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) {
- CriticalSectionScoped lock(crit_.get());
- SsrcEncoderMap::iterator it = encoders_.find(ssrc);
- if (it == encoders_.end())
- return;
-
- it->second->OnReceivedSLI(ssrc, picture_id);
-}
-
-void EncoderStateFeedback::OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) {
- CriticalSectionScoped lock(crit_.get());
- SsrcEncoderMap::iterator it = encoders_.find(ssrc);
- if (it == encoders_.end())
- return;
-
- it->second->OnReceivedRPSI(ssrc, picture_id);
-}
-
-void EncoderStateFeedback::OnLocalSsrcChanged(uint32_t old_ssrc,
- uint32_t new_ssrc) {
- CriticalSectionScoped lock(crit_.get());
- SsrcEncoderMap::iterator it = encoders_.find(old_ssrc);
- if (it == encoders_.end() || encoders_.find(new_ssrc) != encoders_.end()) {
- return;
- }
-
- ViEEncoder* encoder = it->second;
- encoders_.erase(it);
- encoders_[new_ssrc] = encoder;
- encoder->OnLocalSsrcChanged(old_ssrc, new_ssrc);
-}
-
-} // namespace webrtc
« no previous file with comments | « webrtc/video_engine/encoder_state_feedback.h ('k') | webrtc/video_engine/encoder_state_feedback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698