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

Unified Diff: webrtc/api/videotracksource.cc

Issue 1773993002: Add VideoTrackSource implementation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 4 years, 9 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 | « webrtc/api/videotracksource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « webrtc/api/videotracksource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698