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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/videotracksource.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/api/videotracksource.h" 11 #include "webrtc/api/videotracksource.h"
12 12
13 // TODO(perkj): This file is added to prepare for splitting VideoSource 13 #include <string>
14 // into two parts, VideoCapturerTrackSource that will inherit VideoTrackSource. 14
15 #include "webrtc/base/bind.h"
16
17 namespace webrtc {
18
19 VideoTrackSource::VideoTrackSource(
20 rtc::VideoSourceInterface<cricket::VideoFrame>* source,
21 rtc::Thread* worker_thread,
22 bool remote)
23 : source_(source),
24 worker_thread_(worker_thread),
25 state_(kInitializing),
26 remote_(remote) {}
27
28 void VideoTrackSource::SetState(SourceState new_state) {
29 if (state_ != new_state) {
30 state_ = new_state;
31 FireOnChanged();
32 }
33 }
34
35 void VideoTrackSource::AddOrUpdateSink(
36 rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
37 const rtc::VideoSinkWants& wants) {
38 worker_thread_->Invoke<void>(rtc::Bind(
39 &rtc::VideoSourceInterface<cricket::VideoFrame>::AddOrUpdateSink, source_,
40 sink, wants));
41 }
42
43 void VideoTrackSource::RemoveSink(
44 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) {
45 worker_thread_->Invoke<void>(
46 rtc::Bind(&rtc::VideoSourceInterface<cricket::VideoFrame>::RemoveSink,
47 source_, sink));
48 }
49
50 } // namespace webrtc
OLDNEW
« 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