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

Unified Diff: webrtc/api/videotrack.cc

Issue 1766653002: Replace SetCapturer and SetCaptureDevice by SetSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Work-in-progress, after applying 1790633002. 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
Index: webrtc/api/videotrack.cc
diff --git a/webrtc/api/videotrack.cc b/webrtc/api/videotrack.cc
index 54c3cce91a11d084ee99b475c53149fe66f53e37..30e2da2107e41fd1000a6eb362fc3495966ccf5b 100644
--- a/webrtc/api/videotrack.cc
+++ b/webrtc/api/videotrack.cc
@@ -20,9 +20,12 @@ VideoTrack::VideoTrack(const std::string& label,
VideoTrackSourceInterface* video_source)
: MediaStreamTrack<VideoTrackInterface>(label),
video_source_(video_source) {
+ RTC_CHECK(video_source);
+ video_source_->RegisterObserver(this);
}
VideoTrack::~VideoTrack() {
+ video_source_->UnregisterObserver(this);
}
std::string VideoTrack::kind() const {
@@ -46,6 +49,10 @@ void VideoTrack::RemoveSink(
video_source_->RemoveSink(sink);
}
+void VideoTrack::GetInfo(rtc::VideoSourceInfo *info) {
+ video_source_->GetInfo(info);
+}
+
bool VideoTrack::set_enabled(bool enable) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
for (auto& sink_pair : sink_pairs()) {
@@ -56,6 +63,15 @@ bool VideoTrack::set_enabled(bool enable) {
return MediaStreamTrack<VideoTrackInterface>::set_enabled(enable);
}
+void VideoTrack::OnChanged() {
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ if (video_source_->state() == MediaSourceInterface::kEnded) {
+ set_state(kEnded);
+ } else {
+ set_state(kLive);
+ }
+}
+
rtc::scoped_refptr<VideoTrack> VideoTrack::Create(
const std::string& id,
VideoTrackSourceInterface* source) {

Powered by Google App Engine
This is Rietveld 408576698