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

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

Issue 1741933002: Prevent a voice channel from sending data before a renderer is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Modifying copyright header to satisfy presubmit bot. 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/remoteaudiosource.h ('k') | webrtc/api/rtpsender.cc » ('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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 // This file contains classes that implement RtpSenderInterface. 11 // This file contains classes that implement RtpSenderInterface.
12 // An RtpSender associates a MediaStreamTrackInterface with an underlying 12 // An RtpSender associates a MediaStreamTrackInterface with an underlying
13 // transport (provided by AudioProviderInterface/VideoProviderInterface) 13 // transport (provided by AudioProviderInterface/VideoProviderInterface)
14 14
15 #ifndef WEBRTC_API_RTPSENDER_H_ 15 #ifndef WEBRTC_API_RTPSENDER_H_
16 #define WEBRTC_API_RTPSENDER_H_ 16 #define WEBRTC_API_RTPSENDER_H_
17 17
18 #include <string> 18 #include <string>
19 19
20 #include "webrtc/api/mediastreamprovider.h" 20 #include "webrtc/api/mediastreamprovider.h"
21 #include "webrtc/api/rtpsenderinterface.h" 21 #include "webrtc/api/rtpsenderinterface.h"
22 #include "webrtc/api/statscollector.h" 22 #include "webrtc/api/statscollector.h"
23 #include "webrtc/base/basictypes.h" 23 #include "webrtc/base/basictypes.h"
24 #include "webrtc/base/criticalsection.h" 24 #include "webrtc/base/criticalsection.h"
25 #include "webrtc/base/scoped_ptr.h" 25 #include "webrtc/base/scoped_ptr.h"
26 #include "webrtc/media/base/audiorenderer.h" 26 #include "webrtc/media/base/audiosource.h"
27 27
28 namespace webrtc { 28 namespace webrtc {
29 29
30 // LocalAudioSinkAdapter receives data callback as a sink to the local 30 // LocalAudioSinkAdapter receives data callback as a sink to the local
31 // AudioTrack, and passes the data to the sink of AudioRenderer. 31 // AudioTrack, and passes the data to the sink of AudioSource.
32 class LocalAudioSinkAdapter : public AudioTrackSinkInterface, 32 class LocalAudioSinkAdapter : public AudioTrackSinkInterface,
33 public cricket::AudioRenderer { 33 public cricket::AudioSource {
34 public: 34 public:
35 LocalAudioSinkAdapter(); 35 LocalAudioSinkAdapter();
36 virtual ~LocalAudioSinkAdapter(); 36 virtual ~LocalAudioSinkAdapter();
37 37
38 private: 38 private:
39 // AudioSinkInterface implementation. 39 // AudioSinkInterface implementation.
40 void OnData(const void* audio_data, 40 void OnData(const void* audio_data,
41 int bits_per_sample, 41 int bits_per_sample,
42 int sample_rate, 42 int sample_rate,
43 size_t number_of_channels, 43 size_t number_of_channels,
44 size_t number_of_frames) override; 44 size_t number_of_frames) override;
45 45
46 // cricket::AudioRenderer implementation. 46 // cricket::AudioSource implementation.
47 void SetSink(cricket::AudioRenderer::Sink* sink) override; 47 void SetSink(cricket::AudioSource::Sink* sink) override;
48 48
49 cricket::AudioRenderer::Sink* sink_; 49 cricket::AudioSource::Sink* sink_;
50 // Critical section protecting |sink_|. 50 // Critical section protecting |sink_|.
51 rtc::CriticalSection lock_; 51 rtc::CriticalSection lock_;
52 }; 52 };
53 53
54 class AudioRtpSender : public ObserverInterface, 54 class AudioRtpSender : public ObserverInterface,
55 public rtc::RefCountedObject<RtpSenderInterface> { 55 public rtc::RefCountedObject<RtpSenderInterface> {
56 public: 56 public:
57 // StatsCollector provided so that Add/RemoveLocalAudioTrack can be called 57 // StatsCollector provided so that Add/RemoveLocalAudioTrack can be called
58 // at the appropriate times. 58 // at the appropriate times.
59 AudioRtpSender(AudioTrackInterface* track, 59 AudioRtpSender(AudioTrackInterface* track,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::string id_; 106 std::string id_;
107 std::string stream_id_; 107 std::string stream_id_;
108 AudioProviderInterface* provider_; 108 AudioProviderInterface* provider_;
109 StatsCollector* stats_; 109 StatsCollector* stats_;
110 rtc::scoped_refptr<AudioTrackInterface> track_; 110 rtc::scoped_refptr<AudioTrackInterface> track_;
111 uint32_t ssrc_ = 0; 111 uint32_t ssrc_ = 0;
112 bool cached_track_enabled_ = false; 112 bool cached_track_enabled_ = false;
113 bool stopped_ = false; 113 bool stopped_ = false;
114 114
115 // Used to pass the data callback from the |track_| to the other end of 115 // Used to pass the data callback from the |track_| to the other end of
116 // cricket::AudioRenderer. 116 // cricket::AudioSource.
117 rtc::scoped_ptr<LocalAudioSinkAdapter> sink_adapter_; 117 rtc::scoped_ptr<LocalAudioSinkAdapter> sink_adapter_;
118 }; 118 };
119 119
120 class VideoRtpSender : public ObserverInterface, 120 class VideoRtpSender : public ObserverInterface,
121 public rtc::RefCountedObject<RtpSenderInterface> { 121 public rtc::RefCountedObject<RtpSenderInterface> {
122 public: 122 public:
123 VideoRtpSender(VideoTrackInterface* track, 123 VideoRtpSender(VideoTrackInterface* track,
124 const std::string& stream_id, 124 const std::string& stream_id,
125 VideoProviderInterface* provider); 125 VideoProviderInterface* provider);
126 126
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 VideoProviderInterface* provider_; 169 VideoProviderInterface* provider_;
170 rtc::scoped_refptr<VideoTrackInterface> track_; 170 rtc::scoped_refptr<VideoTrackInterface> track_;
171 uint32_t ssrc_ = 0; 171 uint32_t ssrc_ = 0;
172 bool cached_track_enabled_ = false; 172 bool cached_track_enabled_ = false;
173 bool stopped_ = false; 173 bool stopped_ = false;
174 }; 174 };
175 175
176 } // namespace webrtc 176 } // namespace webrtc
177 177
178 #endif // WEBRTC_API_RTPSENDER_H_ 178 #endif // WEBRTC_API_RTPSENDER_H_
OLDNEW
« no previous file with comments | « webrtc/api/remoteaudiosource.h ('k') | webrtc/api/rtpsender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698