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

Unified Diff: talk/media/base/capturerenderadapter.cc

Issue 1594973006: New rtc::VideoSinkInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Workaround to not break chrome. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/media/base/capturerenderadapter.h ('k') | talk/media/base/fakecapturemanager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/media/base/capturerenderadapter.cc
diff --git a/talk/media/base/capturerenderadapter.cc b/talk/media/base/capturerenderadapter.cc
index e5e8f4c58baaf3ed6db0723fd9a142aaa801b5db..87b3c11d897d1be27d728005ff580023a2821f1e 100644
--- a/talk/media/base/capturerenderadapter.cc
+++ b/talk/media/base/capturerenderadapter.cc
@@ -43,7 +43,7 @@ CaptureRenderAdapter::~CaptureRenderAdapter() {
// outstanding calls to OnVideoFrame will be done when this is done, and no
// more calls will be serviced by this.
// We do this explicitly instead of just letting the has_slots<> destructor
- // take care of it because we need to do this *before* video_renderers_ is
+ // take care of it because we need to do this *before* sinks_ is
// cleared by the destructor; otherwise we could mess with it while
// OnVideoFrame is running.
// We *don't* take capture_crit_ here since it could deadlock with the lock
@@ -61,32 +61,23 @@ CaptureRenderAdapter* CaptureRenderAdapter::Create(
return return_value;
}
-void CaptureRenderAdapter::AddRenderer(VideoRenderer* video_renderer) {
- RTC_DCHECK(video_renderer);
+void CaptureRenderAdapter::AddSink(rtc::VideoSinkInterface<VideoFrame>* sink) {
+ RTC_DCHECK(sink);
rtc::CritScope cs(&capture_crit_);
// This implements set semantics, the same renderer can only be
// added once.
// TODO(nisse): Is this really needed?
- if (std::find(video_renderers_.begin(), video_renderers_.end(),
- video_renderer) == video_renderers_.end())
- video_renderers_.push_back(video_renderer);
+ if (std::find(sinks_.begin(), sinks_.end(), sink) == sinks_.end())
+ sinks_.push_back(sink);
}
-void CaptureRenderAdapter::RemoveRenderer(VideoRenderer* video_renderer) {
- RTC_DCHECK(video_renderer);
+void CaptureRenderAdapter::RemoveSink(
+ rtc::VideoSinkInterface<VideoFrame>* sink) {
+ RTC_DCHECK(sink);
rtc::CritScope cs(&capture_crit_);
- // TODO(nisse): Switch to using std::list, and use its remove
- // method. And similarly in VideoTrackRenderers, which this class
- // mostly duplicates.
- for (VideoRenderers::iterator iter = video_renderers_.begin();
- iter != video_renderers_.end(); ++iter) {
- if (video_renderer == *iter) {
- video_renderers_.erase(iter);
- break;
- }
- }
+ sinks_.erase(std::remove(sinks_.begin(), sinks_.end(), sink), sinks_.end());
}
void CaptureRenderAdapter::Init() {
@@ -98,12 +89,12 @@ void CaptureRenderAdapter::Init() {
void CaptureRenderAdapter::OnVideoFrame(VideoCapturer* capturer,
const VideoFrame* video_frame) {
rtc::CritScope cs(&capture_crit_);
- if (video_renderers_.empty()) {
+ if (sinks_.empty()) {
return;
}
- for (auto* renderer : video_renderers_)
- renderer->RenderFrame(video_frame);
+ for (auto* sink : sinks_)
+ sink->OnFrame(*video_frame);
}
} // namespace cricket
« no previous file with comments | « talk/media/base/capturerenderadapter.h ('k') | talk/media/base/fakecapturemanager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698