Index: talk/media/base/capturerenderadapter.cc |
diff --git a/talk/media/base/capturerenderadapter.cc b/talk/media/base/capturerenderadapter.cc |
index 87b3c11d897d1be27d728005ff580023a2821f1e..e5e8f4c58baaf3ed6db0723fd9a142aaa801b5db 100644 |
--- a/talk/media/base/capturerenderadapter.cc |
+++ b/talk/media/base/capturerenderadapter.cc |
@@ -43,7 +43,7 @@ |
// 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* sinks_ is |
+ // take care of it because we need to do this *before* video_renderers_ 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,23 +61,32 @@ |
return return_value; |
} |
-void CaptureRenderAdapter::AddSink(rtc::VideoSinkInterface<VideoFrame>* sink) { |
- RTC_DCHECK(sink); |
+void CaptureRenderAdapter::AddRenderer(VideoRenderer* video_renderer) { |
+ RTC_DCHECK(video_renderer); |
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(sinks_.begin(), sinks_.end(), sink) == sinks_.end()) |
- sinks_.push_back(sink); |
+ if (std::find(video_renderers_.begin(), video_renderers_.end(), |
+ video_renderer) == video_renderers_.end()) |
+ video_renderers_.push_back(video_renderer); |
} |
-void CaptureRenderAdapter::RemoveSink( |
- rtc::VideoSinkInterface<VideoFrame>* sink) { |
- RTC_DCHECK(sink); |
+void CaptureRenderAdapter::RemoveRenderer(VideoRenderer* video_renderer) { |
+ RTC_DCHECK(video_renderer); |
rtc::CritScope cs(&capture_crit_); |
- sinks_.erase(std::remove(sinks_.begin(), sinks_.end(), sink), sinks_.end()); |
+ // 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; |
+ } |
+ } |
} |
void CaptureRenderAdapter::Init() { |
@@ -89,12 +98,12 @@ |
void CaptureRenderAdapter::OnVideoFrame(VideoCapturer* capturer, |
const VideoFrame* video_frame) { |
rtc::CritScope cs(&capture_crit_); |
- if (sinks_.empty()) { |
+ if (video_renderers_.empty()) { |
return; |
} |
- for (auto* sink : sinks_) |
- sink->OnFrame(*video_frame); |
+ for (auto* renderer : video_renderers_) |
+ renderer->RenderFrame(video_frame); |
} |
} // namespace cricket |