• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2011 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef PC_AUDIO_TRACK_H_
12 #define PC_AUDIO_TRACK_H_
13 
14 #include <string>
15 
16 #include "api/media_stream_interface.h"
17 #include "api/scoped_refptr.h"
18 #include "pc/media_stream_track.h"
19 #include "rtc_base/constructor_magic.h"
20 #include "rtc_base/thread_checker.h"
21 
22 namespace webrtc {
23 
24 class AudioTrack : public MediaStreamTrack<AudioTrackInterface>,
25                    public ObserverInterface {
26  protected:
27   // Protected ctor to force use of factory method.
28   AudioTrack(const std::string& label,
29              const rtc::scoped_refptr<AudioSourceInterface>& source);
30   ~AudioTrack() override;
31 
32  public:
33   static rtc::scoped_refptr<AudioTrack> Create(
34       const std::string& id,
35       const rtc::scoped_refptr<AudioSourceInterface>& source);
36 
37  private:
38   // MediaStreamTrack implementation.
39   std::string kind() const override;
40 
41   // AudioTrackInterface implementation.
42   AudioSourceInterface* GetSource() const override;
43 
44   void AddSink(AudioTrackSinkInterface* sink) override;
45   void RemoveSink(AudioTrackSinkInterface* sink) override;
46 
47   // ObserverInterface implementation.
48   void OnChanged() override;
49 
50  private:
51   const rtc::scoped_refptr<AudioSourceInterface> audio_source_;
52   rtc::ThreadChecker thread_checker_;
53   RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioTrack);
54 };
55 
56 }  // namespace webrtc
57 
58 #endif  // PC_AUDIO_TRACK_H_
59