| Index: webrtc/api/videotracksource.cc
|
| diff --git a/webrtc/api/videotracksource.cc b/webrtc/api/videotracksource.cc
|
| index 1e1020c6719d25c4b2ad9c4363dfc90c0b07350b..3b5e19a5b733aef9d1cefe9ba40dc49cde9b1fcb 100644
|
| --- a/webrtc/api/videotracksource.cc
|
| +++ b/webrtc/api/videotracksource.cc
|
| @@ -10,5 +10,41 @@
|
|
|
| #include "webrtc/api/videotracksource.h"
|
|
|
| -// TODO(perkj): This file is added to prepare for splitting VideoSource
|
| -// into two parts, VideoCapturerTrackSource that will inherit VideoTrackSource.
|
| +#include <string>
|
| +
|
| +#include "webrtc/base/bind.h"
|
| +
|
| +namespace webrtc {
|
| +
|
| +VideoTrackSource::VideoTrackSource(
|
| + rtc::VideoSourceInterface<cricket::VideoFrame>* source,
|
| + rtc::Thread* worker_thread,
|
| + bool remote)
|
| + : source_(source),
|
| + worker_thread_(worker_thread),
|
| + state_(kInitializing),
|
| + remote_(remote) {}
|
| +
|
| +void VideoTrackSource::SetState(SourceState new_state) {
|
| + if (state_ != new_state) {
|
| + state_ = new_state;
|
| + FireOnChanged();
|
| + }
|
| +}
|
| +
|
| +void VideoTrackSource::AddOrUpdateSink(
|
| + rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
|
| + const rtc::VideoSinkWants& wants) {
|
| + worker_thread_->Invoke<void>(rtc::Bind(
|
| + &rtc::VideoSourceInterface<cricket::VideoFrame>::AddOrUpdateSink, source_,
|
| + sink, wants));
|
| +}
|
| +
|
| +void VideoTrackSource::RemoveSink(
|
| + rtc::VideoSinkInterface<cricket::VideoFrame>* sink) {
|
| + worker_thread_->Invoke<void>(
|
| + rtc::Bind(&rtc::VideoSourceInterface<cricket::VideoFrame>::RemoveSink,
|
| + source_, sink));
|
| +}
|
| +
|
| +} // namespace webrtc
|
|
|