Chromium Code Reviews| Index: talk/media/base/videosourcebase.cc |
| diff --git a/talk/app/webrtc/sctputils.h b/talk/media/base/videosourcebase.cc |
| similarity index 58% |
| copy from talk/app/webrtc/sctputils.h |
| copy to talk/media/base/videosourcebase.cc |
| index f16873c4c3d66d59a56b65f60890e125b64d690c..8c00efc1fd2d6fca7895f92e415c43db09852d74 100644 |
| --- a/talk/app/webrtc/sctputils.h |
| +++ b/talk/media/base/videosourcebase.cc |
| @@ -1,6 +1,6 @@ |
| /* |
| * libjingle |
| - * Copyright 2013 Google Inc. |
| + * Copyright 2016 Google Inc. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are met: |
| @@ -25,34 +25,39 @@ |
| * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef TALK_APP_WEBRTC_SCTPUTILS_H_ |
| -#define TALK_APP_WEBRTC_SCTPUTILS_H_ |
| +#include "talk/media/base/videosourcebase.h" |
| -#include <string> |
| - |
| -#include "talk/app/webrtc/datachannelinterface.h" |
| +#include "webrtc/base/checks.h" |
| namespace rtc { |
| -class Buffer; |
| -} // namespace rtc |
| - |
| -namespace webrtc { |
| -struct DataChannelInit; |
| - |
| -// Read the message type and return true if it's an OPEN message. |
| -bool IsOpenMessage(const rtc::Buffer& payload); |
| -bool ParseDataChannelOpenMessage(const rtc::Buffer& payload, |
| - std::string* label, |
| - DataChannelInit* config); |
| +void VideoSourceBase::AddSink(VideoSinkInterface<cricket::VideoFrame>* sink, |
| + const VideoSinkCapabilities& capabilities) { |
| + rtc::CritScope cs(&sink_lock_); |
| + RTC_DCHECK(sink != nullptr); |
| + RTC_DCHECK(sinks_.find(sink) == sinks_.end()); |
|
nisse-webrtc
2016/02/03 09:16:34
This seems pointless when using a set.
pthatcher1
2016/02/03 15:38:36
And even if we change to a vector, it should proba
perkj_webrtc
2016/02/08 14:32:01
I prefer finding and if possible - fix clients tha
|
| + // TODO(perkj): Refactor to allow different sinks to have different |
| + // capabilities. |
| + RTC_DCHECK(sinks_.empty() || capabilities.equals(capabilities)); |
| + capabilities_ = capabilities; |
| + sinks_.insert(sink); |
| + OnSinkCapabilitiesChanged(capabilities_); |
| +} |
| + |
| +void VideoSourceBase::RemoveSink( |
| + VideoSinkInterface<cricket::VideoFrame>* sink) { |
| + RTC_DCHECK(sink != nullptr); |
| + |
| + rtc::CritScope cs(&sink_lock_); |
| + RTC_DCHECK(sinks_.find(sink) != sinks_.end()); |
| + sinks_.erase(sink); |
| +} |
| + |
| +void VideoSourceBase::DeliverFrameToSinks(const cricket::VideoFrame& frame) { |
| + rtc::CritScope cs(&sink_lock_); |
| + for (auto* sink : sinks_) { |
| + sink->OnFrame(frame); |
| + } |
| +} |
| -bool ParseDataChannelOpenAckMessage(const rtc::Buffer& payload); |
| - |
| -bool WriteDataChannelOpenMessage(const std::string& label, |
| - const DataChannelInit& config, |
| - rtc::Buffer* payload); |
| - |
| -void WriteDataChannelOpenAckMessage(rtc::Buffer* payload); |
| -} // namespace webrtc |
| - |
| -#endif // TALK_APP_WEBRTC_SCTPUTILS_H_ |
| +} // namespace rtc |