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

Side by Side Diff: webrtc/api/mediastreamtrack.h

Issue 2514883002: Create //webrtc/api:libjingle_peerconnection_api + refactorings. (Closed)
Patch Set: Rebase Created 3 years, 11 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/mediastreamobserver.cc ('k') | webrtc/api/mediatypes.h » ('j') | 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 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2011 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 #ifndef WEBRTC_API_MEDIASTREAMTRACK_H_ 11 #ifndef WEBRTC_API_MEDIASTREAMTRACK_H_
12 #define WEBRTC_API_MEDIASTREAMTRACK_H_ 12 #define WEBRTC_API_MEDIASTREAMTRACK_H_
13 13
14 #include <string> 14 // Including this file is deprecated. It is no longer part of the public API.
15 15 // This only includes the file in its new location for backwards compatibility.
16 #include "webrtc/api/mediastreaminterface.h" 16 #include "webrtc/pc/mediastreamtrack.h"
17 #include "webrtc/api/notifier.h"
18
19 namespace webrtc {
20
21 // MediaTrack implements the interface common to AudioTrackInterface and
22 // VideoTrackInterface.
23 template <typename T>
24 class MediaStreamTrack : public Notifier<T> {
25 public:
26 typedef typename T::TrackState TypedTrackState;
27
28 std::string id() const override { return id_; }
29 MediaStreamTrackInterface::TrackState state() const override {
30 return state_;
31 }
32 bool enabled() const override { return enabled_; }
33 bool set_enabled(bool enable) override {
34 bool fire_on_change = (enable != enabled_);
35 enabled_ = enable;
36 if (fire_on_change) {
37 Notifier<T>::FireOnChanged();
38 }
39 return fire_on_change;
40 }
41
42 protected:
43 explicit MediaStreamTrack(const std::string& id)
44 : enabled_(true), id_(id), state_(MediaStreamTrackInterface::kLive) {}
45
46 bool set_state(MediaStreamTrackInterface::TrackState new_state) {
47 bool fire_on_change = (state_ != new_state);
48 state_ = new_state;
49 if (fire_on_change)
50 Notifier<T>::FireOnChanged();
51 return true;
52 }
53
54 private:
55 bool enabled_;
56 std::string id_;
57 MediaStreamTrackInterface::TrackState state_;
58 };
59
60 } // namespace webrtc
61 17
62 #endif // WEBRTC_API_MEDIASTREAMTRACK_H_ 18 #endif // WEBRTC_API_MEDIASTREAMTRACK_H_
OLDNEW
« no previous file with comments | « webrtc/api/mediastreamobserver.cc ('k') | webrtc/api/mediatypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698