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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.h

Issue 1766653002: Replace SetCapturer and SetCaptureDevice by SetSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased, no longer any proxy object changes. Created 4 years, 8 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/media/base/videoengine_unittest.h ('k') | webrtc/media/engine/webrtcvideoengine2.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 (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 bool mute, 154 bool mute,
155 const VideoOptions* options) override; 155 const VideoOptions* options) override;
156 bool AddSendStream(const StreamParams& sp) override; 156 bool AddSendStream(const StreamParams& sp) override;
157 bool RemoveSendStream(uint32_t ssrc) override; 157 bool RemoveSendStream(uint32_t ssrc) override;
158 bool AddRecvStream(const StreamParams& sp) override; 158 bool AddRecvStream(const StreamParams& sp) override;
159 bool AddRecvStream(const StreamParams& sp, bool default_stream); 159 bool AddRecvStream(const StreamParams& sp, bool default_stream);
160 bool RemoveRecvStream(uint32_t ssrc) override; 160 bool RemoveRecvStream(uint32_t ssrc) override;
161 bool SetSink(uint32_t ssrc, 161 bool SetSink(uint32_t ssrc,
162 rtc::VideoSinkInterface<VideoFrame>* sink) override; 162 rtc::VideoSinkInterface<VideoFrame>* sink) override;
163 bool GetStats(VideoMediaInfo* info) override; 163 bool GetStats(VideoMediaInfo* info) override;
164 bool SetCapturer(uint32_t ssrc, VideoCapturer* capturer) override; 164 void SetSource(
165 uint32_t ssrc,
166 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override;
165 167
166 void OnPacketReceived(rtc::CopyOnWriteBuffer* packet, 168 void OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
167 const rtc::PacketTime& packet_time) override; 169 const rtc::PacketTime& packet_time) override;
168 void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet, 170 void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
169 const rtc::PacketTime& packet_time) override; 171 const rtc::PacketTime& packet_time) override;
170 void OnReadyToSend(bool ready) override; 172 void OnReadyToSend(bool ready) override;
171 void OnNetworkRouteChanged(const std::string& transport_name, 173 void OnNetworkRouteChanged(const std::string& transport_name,
172 const NetworkRoute& network_route) override; 174 const NetworkRoute& network_route) override;
173 void SetInterface(NetworkInterface* iface) override; 175 void SetInterface(NetworkInterface* iface) override;
174 176
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // These optionals are unset if not changed. 212 // These optionals are unset if not changed.
211 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings; 213 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings;
212 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; 214 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
213 }; 215 };
214 216
215 bool GetChangedSendParameters(const VideoSendParameters& params, 217 bool GetChangedSendParameters(const VideoSendParameters& params,
216 ChangedSendParameters* changed_params) const; 218 ChangedSendParameters* changed_params) const;
217 bool GetChangedRecvParameters(const VideoRecvParameters& params, 219 bool GetChangedRecvParameters(const VideoRecvParameters& params,
218 ChangedRecvParameters* changed_params) const; 220 ChangedRecvParameters* changed_params) const;
219 221
220 bool MuteStream(uint32_t ssrc, bool mute);
221
222 void SetMaxSendBandwidth(int bps); 222 void SetMaxSendBandwidth(int bps);
223 void SetOptions(uint32_t ssrc, const VideoOptions& options); 223 void SetOptions(uint32_t ssrc, const VideoOptions& options);
224 224
225 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, 225 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config,
226 const StreamParams& sp) const; 226 const StreamParams& sp) const;
227 bool CodecIsExternallySupported(const std::string& name) const; 227 bool CodecIsExternallySupported(const std::string& name) const;
228 bool ValidateSendSsrcAvailability(const StreamParams& sp) const 228 bool ValidateSendSsrcAvailability(const StreamParams& sp) const
229 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); 229 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
230 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const 230 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const
231 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); 231 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
232 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) 232 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream)
233 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); 233 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
234 234
235 static std::string CodecSettingsVectorToString( 235 static std::string CodecSettingsVectorToString(
236 const std::vector<VideoCodecSettings>& codecs); 236 const std::vector<VideoCodecSettings>& codecs);
237 237
238 // Wrapper for the sender part, this is where the capturer is connected and 238 // Wrapper for the sender part, this is where the source is connected and
239 // frames are then converted from cricket frames to webrtc frames. 239 // frames are then converted from cricket frames to webrtc frames.
240 class WebRtcVideoSendStream 240 class WebRtcVideoSendStream
241 : public rtc::VideoSinkInterface<cricket::VideoFrame>, 241 : public rtc::VideoSinkInterface<cricket::VideoFrame>,
242 public webrtc::LoadObserver { 242 public webrtc::LoadObserver {
243 public: 243 public:
244 WebRtcVideoSendStream( 244 WebRtcVideoSendStream(
245 webrtc::Call* call, 245 webrtc::Call* call,
246 const StreamParams& sp, 246 const StreamParams& sp,
247 const webrtc::VideoSendStream::Config& config, 247 const webrtc::VideoSendStream::Config& config,
248 const VideoOptions& options, 248 const VideoOptions& options,
249 WebRtcVideoEncoderFactory* external_encoder_factory, 249 WebRtcVideoEncoderFactory* external_encoder_factory,
250 bool enable_cpu_overuse_detection, 250 bool enable_cpu_overuse_detection,
251 int max_bitrate_bps, 251 int max_bitrate_bps,
252 const rtc::Optional<VideoCodecSettings>& codec_settings, 252 const rtc::Optional<VideoCodecSettings>& codec_settings,
253 const std::vector<webrtc::RtpExtension>& rtp_extensions, 253 const std::vector<webrtc::RtpExtension>& rtp_extensions,
254 const VideoSendParameters& send_params); 254 const VideoSendParameters& send_params);
255 virtual ~WebRtcVideoSendStream(); 255 virtual ~WebRtcVideoSendStream();
256 256
257 void SetOptions(const VideoOptions& options); 257 void SetOptions(const VideoOptions& options);
258 // TODO(pbos): Move logic from SetOptions into this method. 258 // TODO(pbos): Move logic from SetOptions into this method.
259 void SetSendParameters(const ChangedSendParameters& send_params); 259 void SetSendParameters(const ChangedSendParameters& send_params);
260 bool SetRtpParameters(const webrtc::RtpParameters& parameters); 260 bool SetRtpParameters(const webrtc::RtpParameters& parameters);
261 webrtc::RtpParameters GetRtpParameters() const; 261 webrtc::RtpParameters GetRtpParameters() const;
262 262
263 void OnFrame(const cricket::VideoFrame& frame) override; 263 void OnFrame(const cricket::VideoFrame& frame) override;
264 bool SetCapturer(VideoCapturer* capturer); 264 void SetSource(rtc::VideoSourceInterface<cricket::VideoFrame>* source);
265 void MuteStream(bool mute); 265 void DisconnectSource();
266 bool DisconnectCapturer();
267 266
268 void SetSend(bool send); 267 void SetSend(bool send);
269 268
270 // Implements webrtc::LoadObserver. 269 // Implements webrtc::LoadObserver.
271 void OnLoadUpdate(Load load) override; 270 void OnLoadUpdate(Load load) override;
272 271
273 const std::vector<uint32_t>& GetSsrcs() const; 272 const std::vector<uint32_t>& GetSsrcs() const;
274 VideoSenderInfo GetVideoSenderInfo(); 273 VideoSenderInfo GetVideoSenderInfo();
275 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); 274 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info);
276 275
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_); 357 void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_);
359 358
360 rtc::ThreadChecker thread_checker_; 359 rtc::ThreadChecker thread_checker_;
361 rtc::AsyncInvoker invoker_; 360 rtc::AsyncInvoker invoker_;
362 rtc::Thread* worker_thread_; 361 rtc::Thread* worker_thread_;
363 const std::vector<uint32_t> ssrcs_; 362 const std::vector<uint32_t> ssrcs_;
364 const std::vector<SsrcGroup> ssrc_groups_; 363 const std::vector<SsrcGroup> ssrc_groups_;
365 webrtc::Call* const call_; 364 webrtc::Call* const call_;
366 rtc::VideoSinkWants sink_wants_; 365 rtc::VideoSinkWants sink_wants_;
367 // Counter used for deciding if the video resolution is currently 366 // Counter used for deciding if the video resolution is currently
368 // restricted by CPU usage. It is reset if |capturer_| is changed. 367 // restricted by CPU usage. It is reset if |source_| is changed.
369 int cpu_restricted_counter_; 368 int cpu_restricted_counter_;
370 // Total number of times resolution as been requested to be changed due to 369 // Total number of times resolution as been requested to be changed due to
371 // CPU adaptation. 370 // CPU adaptation.
372 int number_of_cpu_adapt_changes_; 371 int number_of_cpu_adapt_changes_;
373 VideoCapturer* capturer_; 372 rtc::VideoSourceInterface<cricket::VideoFrame>* source_;
374 WebRtcVideoEncoderFactory* const external_encoder_factory_ 373 WebRtcVideoEncoderFactory* const external_encoder_factory_
375 GUARDED_BY(lock_); 374 GUARDED_BY(lock_);
376 375
377 rtc::CriticalSection lock_; 376 rtc::CriticalSection lock_;
378 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); 377 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_);
379 // Contains settings that are the same for all streams in the MediaChannel, 378 // Contains settings that are the same for all streams in the MediaChannel,
380 // such as codecs, header extensions, and the global bitrate limit for the 379 // such as codecs, header extensions, and the global bitrate limit for the
381 // entire channel. 380 // entire channel.
382 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); 381 VideoSendStreamParameters parameters_ GUARDED_BY(lock_);
383 // Contains settings that are unique for each stream, such as max_bitrate. 382 // Contains settings that are unique for each stream, such as max_bitrate.
384 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. 383 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
385 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only 384 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
386 // one stream per MediaChannel. 385 // one stream per MediaChannel.
387 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); 386 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_);
388 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); 387 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_);
389 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); 388 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_);
390 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); 389 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_);
391 Dimensions last_dimensions_ GUARDED_BY(lock_); 390 Dimensions last_dimensions_ GUARDED_BY(lock_);
392 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) = 391 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) =
393 webrtc::kVideoRotation_0; 392 webrtc::kVideoRotation_0;
394 393
395 bool sending_ GUARDED_BY(lock_); 394 bool sending_ GUARDED_BY(lock_);
396 bool muted_ GUARDED_BY(lock_);
397 395
398 // The timestamp of the first frame received 396 // The timestamp of the first frame received
399 // Used to generate the timestamps of subsequent frames 397 // Used to generate the timestamps of subsequent frames
400 int64_t first_frame_timestamp_ms_ GUARDED_BY(lock_); 398 int64_t first_frame_timestamp_ms_ GUARDED_BY(lock_);
401 399
402 // The timestamp of the last frame received 400 // The timestamp of the last frame received
403 // Used to generate timestamp for the black frame when capturer is removed 401 // Used to generate timestamp for the black frame when source is removed
404 int64_t last_frame_timestamp_ms_ GUARDED_BY(lock_); 402 int64_t last_frame_timestamp_ms_ GUARDED_BY(lock_);
405 }; 403 };
406 404
407 // Wrapper for the receiver part, contains configs etc. that are needed to 405 // Wrapper for the receiver part, contains configs etc. that are needed to
408 // reconstruct the underlying VideoReceiveStream. Also serves as a wrapper 406 // reconstruct the underlying VideoReceiveStream. Also serves as a wrapper
409 // between rtc::VideoSinkInterface<webrtc::VideoFrame> and 407 // between rtc::VideoSinkInterface<webrtc::VideoFrame> and
410 // rtc::VideoSinkInterface<cricket::VideoFrame>. 408 // rtc::VideoSinkInterface<cricket::VideoFrame>.
411 class WebRtcVideoReceiveStream 409 class WebRtcVideoReceiveStream
412 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { 410 : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
413 public: 411 public:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // TODO(deadbeef): Don't duplicate information between 533 // TODO(deadbeef): Don't duplicate information between
536 // send_params/recv_params, rtp_extensions, options, etc. 534 // send_params/recv_params, rtp_extensions, options, etc.
537 VideoSendParameters send_params_; 535 VideoSendParameters send_params_;
538 VideoOptions default_send_options_; 536 VideoOptions default_send_options_;
539 VideoRecvParameters recv_params_; 537 VideoRecvParameters recv_params_;
540 }; 538 };
541 539
542 } // namespace cricket 540 } // namespace cricket
543 541
544 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ 542 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/videoengine_unittest.h ('k') | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698