OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 the PeerConnection interface as defined in | 11 // This file contains the PeerConnection interface as defined in |
12 // http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-connections. | 12 // http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-connections. |
13 // Applications must use this interface to implement peerconnection. | |
14 // PeerConnectionFactory class provides factory methods to create | |
15 // peerconnection, mediastream and media tracks objects. | |
16 // | 13 // |
17 // The Following steps are needed to setup a typical call using Jsep. | 14 // The PeerConnectionFactory class provides factory methods to create |
| 15 // PeerConnection, MediaStream and MediaStreamTrack objects. |
| 16 // |
| 17 // The following steps are needed to setup a typical call using WebRTC: |
| 18 // |
18 // 1. Create a PeerConnectionFactoryInterface. Check constructors for more | 19 // 1. Create a PeerConnectionFactoryInterface. Check constructors for more |
19 // information about input parameters. | 20 // information about input parameters. |
20 // 2. Create a PeerConnection object. Provide a configuration string which | 21 // |
21 // points either to stun or turn server to generate ICE candidates and provide | 22 // 2. Create a PeerConnection object. Provide a configuration struct which |
22 // an object that implements the PeerConnectionObserver interface. | 23 // points to STUN and/or TURN servers used to generate ICE candidates, and |
23 // 3. Create local MediaStream and MediaTracks using the PeerConnectionFactory | 24 // provide an object that implements the PeerConnectionObserver interface, |
24 // and add it to PeerConnection by calling AddStream. | 25 // which is used to receive callbacks from the PeerConnection. |
25 // 4. Create an offer and serialize it and send it to the remote peer. | 26 // |
26 // 5. Once an ice candidate have been found PeerConnection will call the | 27 // 3. Create local MediaStreamTracks using the PeerConnectionFactory and add |
| 28 // them to PeerConnection by calling AddTrack (or legacy method, AddStream). |
| 29 // |
| 30 // 4. Create an offer, call SetLocalDescription with it, serialize it, and send |
| 31 // it to the remote peer |
| 32 // |
| 33 // 5. Once an ICE candidate has been gathered, the PeerConnection will call the |
27 // observer function OnIceCandidate. The candidates must also be serialized and | 34 // observer function OnIceCandidate. The candidates must also be serialized and |
28 // sent to the remote peer. | 35 // sent to the remote peer. |
| 36 // |
29 // 6. Once an answer is received from the remote peer, call | 37 // 6. Once an answer is received from the remote peer, call |
30 // SetLocalSessionDescription with the offer and SetRemoteSessionDescription | 38 // SetRemoteDescription with the remote answer. |
31 // with the remote answer. | 39 // |
32 // 7. Once a remote candidate is received from the remote peer, provide it to | 40 // 7. Once a remote candidate is received from the remote peer, provide it to |
33 // the peerconnection by calling AddIceCandidate. | 41 // the PeerConnection by calling AddIceCandidate. |
34 | 42 // |
35 | 43 // The receiver of a call (assuming the application is "call"-based) can decide |
36 // The Receiver of a call can decide to accept or reject the call. | 44 // to accept or reject the call; this decision will be taken by the application, |
37 // This decision will be taken by the application not peerconnection. | 45 // not the PeerConnection. |
38 // If application decides to accept the call | 46 // |
| 47 // If the application decides to accept the call, it should: |
| 48 // |
39 // 1. Create PeerConnectionFactoryInterface if it doesn't exist. | 49 // 1. Create PeerConnectionFactoryInterface if it doesn't exist. |
| 50 // |
40 // 2. Create a new PeerConnection. | 51 // 2. Create a new PeerConnection. |
| 52 // |
41 // 3. Provide the remote offer to the new PeerConnection object by calling | 53 // 3. Provide the remote offer to the new PeerConnection object by calling |
42 // SetRemoteSessionDescription. | 54 // SetRemoteDescription. |
| 55 // |
43 // 4. Generate an answer to the remote offer by calling CreateAnswer and send it | 56 // 4. Generate an answer to the remote offer by calling CreateAnswer and send it |
44 // back to the remote peer. | 57 // back to the remote peer. |
| 58 // |
45 // 5. Provide the local answer to the new PeerConnection by calling | 59 // 5. Provide the local answer to the new PeerConnection by calling |
46 // SetLocalSessionDescription with the answer. | 60 // SetLocalDescription with the answer. |
47 // 6. Provide the remote ice candidates by calling AddIceCandidate. | 61 // |
48 // 7. Once a candidate have been found PeerConnection will call the observer | 62 // 6. Provide the remote ICE candidates by calling AddIceCandidate. |
49 // function OnIceCandidate. Send these candidates to the remote peer. | 63 // |
| 64 // 7. Once a candidate has been gathered, the PeerConnection will call the |
| 65 // observer function OnIceCandidate. Send these candidates to the remote peer. |
50 | 66 |
51 #ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 67 #ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
52 #define WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 68 #define WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
53 | 69 |
54 #include <memory> | 70 #include <memory> |
55 #include <ostream> | 71 #include <ostream> |
56 #include <string> | 72 #include <string> |
57 #include <utility> | 73 #include <utility> |
58 #include <vector> | 74 #include <vector> |
59 | 75 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 350 } |
335 void set_prerenderer_smoothing(bool enable) { | 351 void set_prerenderer_smoothing(bool enable) { |
336 media_config.video.disable_prerenderer_smoothing = !enable; | 352 media_config.video.disable_prerenderer_smoothing = !enable; |
337 } | 353 } |
338 | 354 |
339 static const int kUndefined = -1; | 355 static const int kUndefined = -1; |
340 // Default maximum number of packets in the audio jitter buffer. | 356 // Default maximum number of packets in the audio jitter buffer. |
341 static const int kAudioJitterBufferMaxPackets = 50; | 357 static const int kAudioJitterBufferMaxPackets = 50; |
342 // ICE connection receiving timeout for aggressive configuration. | 358 // ICE connection receiving timeout for aggressive configuration. |
343 static const int kAggressiveIceConnectionReceivingTimeout = 1000; | 359 static const int kAggressiveIceConnectionReceivingTimeout = 1000; |
| 360 |
| 361 //////////////////////////////////////////////////////////////////////// |
| 362 // The below few fields mirror the standard RTCConfiguration dictionary: |
| 363 // https://www.w3.org/TR/webrtc/#rtcconfiguration-dictionary |
| 364 //////////////////////////////////////////////////////////////////////// |
| 365 |
| 366 // TODO(pthatcher): Rename this ice_servers, but update Chromium |
| 367 // at the same time. |
| 368 IceServers servers; |
344 // TODO(pthatcher): Rename this ice_transport_type, but update | 369 // TODO(pthatcher): Rename this ice_transport_type, but update |
345 // Chromium at the same time. | 370 // Chromium at the same time. |
346 IceTransportsType type = kAll; | 371 IceTransportsType type = kAll; |
347 // TODO(pthatcher): Rename this ice_servers, but update Chromium | |
348 // at the same time. | |
349 IceServers servers; | |
350 BundlePolicy bundle_policy = kBundlePolicyBalanced; | 372 BundlePolicy bundle_policy = kBundlePolicyBalanced; |
351 RtcpMuxPolicy rtcp_mux_policy = kRtcpMuxPolicyRequire; | 373 RtcpMuxPolicy rtcp_mux_policy = kRtcpMuxPolicyRequire; |
| 374 std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates; |
| 375 int ice_candidate_pool_size = 0; |
| 376 |
| 377 ////////////////////////////////////////////////////////////////////////// |
| 378 // The below fields correspond to constraints from the deprecated |
| 379 // constraints interface for constructing a PeerConnection. |
| 380 // |
| 381 // rtc::Optional fields can be "missing", in which case the implementation |
| 382 // default will be used. |
| 383 ////////////////////////////////////////////////////////////////////////// |
| 384 |
| 385 // If set to true, don't gather IPv6 ICE candidates. |
| 386 // TODO(deadbeef): Remove this? IPv6 support has long stopped being |
| 387 // experimental |
| 388 bool disable_ipv6 = false; |
| 389 |
| 390 // If set to true, use RTP data channels instead of SCTP. |
| 391 // TODO(deadbeef): Remove this. We no longer commit to supporting RTP data |
| 392 // channels, though some applications are still working on moving off of |
| 393 // them. |
| 394 bool enable_rtp_data_channel = false; |
| 395 |
| 396 // Minimum bitrate at which screencast video tracks will be encoded at. |
| 397 // This means adding padding bits up to this bitrate, which can help |
| 398 // when switching from a static scene to one with motion. |
| 399 rtc::Optional<int> screencast_min_bitrate; |
| 400 |
| 401 // Use new combined audio/video bandwidth estimation? |
| 402 rtc::Optional<bool> combined_audio_video_bwe; |
| 403 |
| 404 // Can be used to disable DTLS-SRTP. This should never be done, but can be |
| 405 // useful for testing purposes, for example in setting up a loopback call |
| 406 // with a single PeerConnection. |
| 407 rtc::Optional<bool> enable_dtls_srtp; |
| 408 |
| 409 ///////////////////////////////////////////////// |
| 410 // The below fields are not part of the standard. |
| 411 ///////////////////////////////////////////////// |
| 412 |
| 413 // Can be used to disable TCP candidate generation. |
352 TcpCandidatePolicy tcp_candidate_policy = kTcpCandidatePolicyEnabled; | 414 TcpCandidatePolicy tcp_candidate_policy = kTcpCandidatePolicyEnabled; |
| 415 |
| 416 // Can be used to avoid gathering candidates for a "higher cost" network, |
| 417 // if a lower cost one exists. For example, if both Wi-Fi and cellular |
| 418 // interfaces are available, this could be used to avoid using the cellular |
| 419 // interface. |
353 CandidateNetworkPolicy candidate_network_policy = | 420 CandidateNetworkPolicy candidate_network_policy = |
354 kCandidateNetworkPolicyAll; | 421 kCandidateNetworkPolicyAll; |
| 422 |
| 423 // The maximum number of packets that can be stored in the NetEq audio |
| 424 // jitter buffer. Can be reduced to lower tolerated audio latency. |
355 int audio_jitter_buffer_max_packets = kAudioJitterBufferMaxPackets; | 425 int audio_jitter_buffer_max_packets = kAudioJitterBufferMaxPackets; |
| 426 |
| 427 // Whether to use the NetEq "fast mode" which will accelerate audio quicker |
| 428 // if it falls behind. |
356 bool audio_jitter_buffer_fast_accelerate = false; | 429 bool audio_jitter_buffer_fast_accelerate = false; |
357 int ice_connection_receiving_timeout = kUndefined; // ms | 430 |
358 int ice_backup_candidate_pair_ping_interval = kUndefined; // ms | 431 // Timeout in milliseconds before an ICE candidate pair is considered to be |
| 432 // "not receiving", after which a lower priority candidate pair may be |
| 433 // selected. |
| 434 int ice_connection_receiving_timeout = kUndefined; |
| 435 |
| 436 // Interval in milliseconds at which an ICE "backup" candidate pair will be |
| 437 // pinged. This is a candidate pair which is not actively in use, but may |
| 438 // be switched to if the active candidate pair becomes unusable. |
| 439 // |
| 440 // This is relevant mainly to Wi-Fi/cell handoff; the application may not |
| 441 // want this backup cellular candidate pair pinged frequently, since it |
| 442 // consumes data/battery. |
| 443 int ice_backup_candidate_pair_ping_interval = kUndefined; |
| 444 |
| 445 // Can be used to enable continual gathering, which means new candidates |
| 446 // will be gathered as network interfaces change. Note that if continual |
| 447 // gathering is used, the candidate removal API should also be used, to |
| 448 // avoid an ever-growing list of candidates. |
359 ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE; | 449 ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE; |
360 std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates; | 450 |
| 451 // If set to true, candidate pairs will be pinged in order of most likely |
| 452 // to work (which means using a TURN server, generally), rather than in |
| 453 // standard priority order. |
361 bool prioritize_most_likely_ice_candidate_pairs = false; | 454 bool prioritize_most_likely_ice_candidate_pairs = false; |
| 455 |
362 struct cricket::MediaConfig media_config; | 456 struct cricket::MediaConfig media_config; |
363 // Flags corresponding to values set by constraint flags. | 457 |
364 // rtc::Optional flags can be "missing", in which case the webrtc | 458 // This doesn't currently work. For a while we were working on adding QUIC |
365 // default applies. | 459 // data channel support to PeerConnection, but decided on a different |
366 bool disable_ipv6 = false; | 460 // approach, and that code hasn't been updated for a while. |
367 bool enable_rtp_data_channel = false; | |
368 bool enable_quic = false; | 461 bool enable_quic = false; |
369 rtc::Optional<int> screencast_min_bitrate; | 462 |
370 rtc::Optional<bool> combined_audio_video_bwe; | 463 // If set to true, only one preferred TURN allocation will be used per |
371 rtc::Optional<bool> enable_dtls_srtp; | 464 // network interface. UDP is preferred over TCP and IPv6 over IPv4. This |
372 int ice_candidate_pool_size = 0; | 465 // can be used to cut down on the number of candidate pairings. |
373 bool prune_turn_ports = false; | 466 bool prune_turn_ports = false; |
| 467 |
374 // If set to true, this means the ICE transport should presume TURN-to-TURN | 468 // If set to true, this means the ICE transport should presume TURN-to-TURN |
375 // candidate pairs will succeed, even before a binding response is received. | 469 // candidate pairs will succeed, even before a binding response is received. |
| 470 // This can be used to optimize the initial connection time, since the DTLS |
| 471 // handshake can begin immediately. |
376 bool presume_writable_when_fully_relayed = false; | 472 bool presume_writable_when_fully_relayed = false; |
| 473 |
377 // If true, "renomination" will be added to the ice options in the transport | 474 // If true, "renomination" will be added to the ice options in the transport |
378 // description. | 475 // description. |
| 476 // See: https://tools.ietf.org/html/draft-thatcher-ice-renomination-00 |
379 bool enable_ice_renomination = false; | 477 bool enable_ice_renomination = false; |
380 // If true, ICE role is redetermined when peerconnection sets a local | 478 |
381 // transport description that indicates an ICE restart. | 479 // If true, the ICE role is re-determined when the PeerConnection sets a |
| 480 // local transport description that indicates an ICE restart. |
| 481 // |
| 482 // This is standard RFC5245 ICE behavior, but causes unnecessary role |
| 483 // thrashing, so an application may wish to avoid it. This role |
| 484 // re-determining was removed in ICEbis (ICE v2). |
382 bool redetermine_role_on_ice_restart = true; | 485 bool redetermine_role_on_ice_restart = true; |
| 486 |
383 // If set, the min interval (max rate) at which we will send ICE checks | 487 // If set, the min interval (max rate) at which we will send ICE checks |
384 // (STUN pings), in milliseconds. | 488 // (STUN pings), in milliseconds. |
385 rtc::Optional<int> ice_check_min_interval; | 489 rtc::Optional<int> ice_check_min_interval; |
| 490 |
386 // | 491 // |
387 // Don't forget to update operator== if adding something. | 492 // Don't forget to update operator== if adding something. |
388 // | 493 // |
389 }; | 494 }; |
390 | 495 |
| 496 // See: https://www.w3.org/TR/webrtc/#idl-def-rtcofferansweroptions |
391 struct RTCOfferAnswerOptions { | 497 struct RTCOfferAnswerOptions { |
392 static const int kUndefined = -1; | 498 static const int kUndefined = -1; |
393 static const int kMaxOfferToReceiveMedia = 1; | 499 static const int kMaxOfferToReceiveMedia = 1; |
394 | 500 |
395 // The default value for constraint offerToReceiveX:true. | 501 // The default value for constraint offerToReceiveX:true. |
396 static const int kOfferToReceiveMediaTrue = 1; | 502 static const int kOfferToReceiveMediaTrue = 1; |
397 | 503 |
| 504 // These have been removed from the standard in favor of the "transceiver" |
| 505 // API, but given that we don't support that API, we still have them here. |
| 506 // |
| 507 // offer_to_receive_X set to 1 will cause a media description to be |
| 508 // generated in the offer, even if no tracks of that type have been added. |
| 509 // Values greater than 1 are treated the same. |
| 510 // |
| 511 // If set to 0, the generated directional attribute will not include the |
| 512 // "recv" direction (meaning it will be "sendonly" or "inactive". |
398 int offer_to_receive_video = kUndefined; | 513 int offer_to_receive_video = kUndefined; |
399 int offer_to_receive_audio = kUndefined; | 514 int offer_to_receive_audio = kUndefined; |
| 515 |
400 bool voice_activity_detection = true; | 516 bool voice_activity_detection = true; |
401 bool ice_restart = false; | 517 bool ice_restart = false; |
| 518 |
| 519 // If true, will offer to BUNDLE audio/video/data together. Not to be |
| 520 // confused with RTCP mux (multiplexing RTP and RTCP together). |
402 bool use_rtp_mux = true; | 521 bool use_rtp_mux = true; |
403 | 522 |
404 RTCOfferAnswerOptions() = default; | 523 RTCOfferAnswerOptions() = default; |
405 | 524 |
406 RTCOfferAnswerOptions(int offer_to_receive_video, | 525 RTCOfferAnswerOptions(int offer_to_receive_video, |
407 int offer_to_receive_audio, | 526 int offer_to_receive_audio, |
408 bool voice_activity_detection, | 527 bool voice_activity_detection, |
409 bool ice_restart, | 528 bool ice_restart, |
410 bool use_rtp_mux) | 529 bool use_rtp_mux) |
411 : offer_to_receive_video(offer_to_receive_video), | 530 : offer_to_receive_video(offer_to_receive_video), |
(...skipping 16 matching lines...) Expand all Loading... |
428 virtual rtc::scoped_refptr<StreamCollectionInterface> | 547 virtual rtc::scoped_refptr<StreamCollectionInterface> |
429 local_streams() = 0; | 548 local_streams() = 0; |
430 | 549 |
431 // Accessor methods to remote streams. | 550 // Accessor methods to remote streams. |
432 virtual rtc::scoped_refptr<StreamCollectionInterface> | 551 virtual rtc::scoped_refptr<StreamCollectionInterface> |
433 remote_streams() = 0; | 552 remote_streams() = 0; |
434 | 553 |
435 // Add a new MediaStream to be sent on this PeerConnection. | 554 // Add a new MediaStream to be sent on this PeerConnection. |
436 // Note that a SessionDescription negotiation is needed before the | 555 // Note that a SessionDescription negotiation is needed before the |
437 // remote peer can receive the stream. | 556 // remote peer can receive the stream. |
| 557 // |
| 558 // This has been removed from the standard in favor of a track-based API. So, |
| 559 // this is equivalent to simply calling AddTrack for each track within the |
| 560 // stream, with the one difference that if "stream->AddTrack(...)" is called |
| 561 // later, the PeerConnection will automatically pick up the new track. Though |
| 562 // this functionality will be deprecated in the future. |
438 virtual bool AddStream(MediaStreamInterface* stream) = 0; | 563 virtual bool AddStream(MediaStreamInterface* stream) = 0; |
439 | 564 |
440 // Remove a MediaStream from this PeerConnection. | 565 // Remove a MediaStream from this PeerConnection. |
441 // Note that a SessionDescription negotiation is need before the | 566 // Note that a SessionDescription negotiation is needed before the |
442 // remote peer is notified. | 567 // remote peer is notified. |
443 virtual void RemoveStream(MediaStreamInterface* stream) = 0; | 568 virtual void RemoveStream(MediaStreamInterface* stream) = 0; |
444 | 569 |
445 // TODO(deadbeef): Make the following two methods pure virtual once | 570 // TODO(deadbeef): Make the following two methods pure virtual once |
446 // implemented by all subclasses of PeerConnectionInterface. | 571 // implemented by all subclasses of PeerConnectionInterface. |
447 // Add a new MediaStreamTrack to be sent on this PeerConnection. | 572 |
| 573 // Add a new MediaStreamTrack to be sent on this PeerConnection, and return |
| 574 // the newly created RtpSender. |
| 575 // |
448 // |streams| indicates which stream labels the track should be associated | 576 // |streams| indicates which stream labels the track should be associated |
449 // with. | 577 // with. |
450 virtual rtc::scoped_refptr<RtpSenderInterface> AddTrack( | 578 virtual rtc::scoped_refptr<RtpSenderInterface> AddTrack( |
451 MediaStreamTrackInterface* track, | 579 MediaStreamTrackInterface* track, |
452 std::vector<MediaStreamInterface*> streams) { | 580 std::vector<MediaStreamInterface*> streams) { |
453 return nullptr; | 581 return nullptr; |
454 } | 582 } |
455 | 583 |
456 // Remove an RtpSender from this PeerConnection. | 584 // Remove an RtpSender from this PeerConnection. |
457 // Returns true on success. | 585 // Returns true on success. |
458 virtual bool RemoveTrack(RtpSenderInterface* sender) { | 586 virtual bool RemoveTrack(RtpSenderInterface* sender) { |
459 return false; | 587 return false; |
460 } | 588 } |
461 | 589 |
462 // Returns pointer to the created DtmfSender on success. | 590 // Returns pointer to a DtmfSender on success. Otherwise returns NULL. |
463 // Otherwise returns NULL. | 591 // |
| 592 // This API is no longer part of the standard; instead DtmfSenders are |
| 593 // obtained from RtpSenders. Which is what the implementation does; it finds |
| 594 // an RtpSender for |track| and just returns its DtmfSender. |
464 virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( | 595 virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( |
465 AudioTrackInterface* track) = 0; | 596 AudioTrackInterface* track) = 0; |
466 | 597 |
467 // TODO(deadbeef): Make these pure virtual once all subclasses implement them. | 598 // TODO(deadbeef): Make these pure virtual once all subclasses implement them. |
| 599 |
| 600 // Creates a sender without a track. Can be used for "early media"/"warmup" |
| 601 // use cases, where the application may want to negotiate video attributes |
| 602 // before a track is available to send. |
| 603 // |
| 604 // The standard way to do this would be through "addTransceiver", but we |
| 605 // don't support that API yet. |
| 606 // |
468 // |kind| must be "audio" or "video". | 607 // |kind| must be "audio" or "video". |
| 608 // |
469 // |stream_id| is used to populate the msid attribute; if empty, one will | 609 // |stream_id| is used to populate the msid attribute; if empty, one will |
470 // be generated automatically. | 610 // be generated automatically. |
471 virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender( | 611 virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender( |
472 const std::string& kind, | 612 const std::string& kind, |
473 const std::string& stream_id) { | 613 const std::string& stream_id) { |
474 return rtc::scoped_refptr<RtpSenderInterface>(); | 614 return rtc::scoped_refptr<RtpSenderInterface>(); |
475 } | 615 } |
476 | 616 |
| 617 // Get all RtpSenders, created either through AddStream, AddTrack, or |
| 618 // CreateSender. Note that these are "Plan B SDP" RtpSenders, not "Unified |
| 619 // Plan SDP" RtpSenders, which means that all senders of a specific media |
| 620 // type share the same media description. |
477 virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders() | 621 virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders() |
478 const { | 622 const { |
479 return std::vector<rtc::scoped_refptr<RtpSenderInterface>>(); | 623 return std::vector<rtc::scoped_refptr<RtpSenderInterface>>(); |
480 } | 624 } |
481 | 625 |
| 626 // Get all RtpReceivers, created when a remote description is applied. |
| 627 // Note that these are "Plan B SDP" RtpReceivers, not "Unified Plan SDP" |
| 628 // RtpReceivers, which means that all receivers of a specific media type |
| 629 // share the same media description. |
| 630 // |
| 631 // It is also possible to have a media description with no associated |
| 632 // RtpReceivers, if the directional attribute does not indicate that the |
| 633 // remote peer is sending any media. |
482 virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers() | 634 virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers() |
483 const { | 635 const { |
484 return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>(); | 636 return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>(); |
485 } | 637 } |
486 | 638 |
487 virtual bool GetStats(StatsObserver* observer, | 639 virtual bool GetStats(StatsObserver* observer, |
488 MediaStreamTrackInterface* track, | 640 MediaStreamTrackInterface* track, |
489 StatsOutputLevel level) = 0; | 641 StatsOutputLevel level) = 0; |
490 // Gets stats using the new stats collection API, see webrtc/api/stats/. These | 642 // Gets stats using the new stats collection API, see webrtc/api/stats/. These |
491 // will replace old stats collection API when the new API has matured enough. | 643 // will replace old stats collection API when the new API has matured enough. |
492 // TODO(hbos): Default implementation that does nothing only exists as to not | 644 // TODO(hbos): Default implementation that does nothing only exists as to not |
493 // break third party projects. As soon as they have been updated this should | 645 // break third party projects. As soon as they have been updated this should |
494 // be changed to "= 0;". | 646 // be changed to "= 0;". |
495 virtual void GetStats(RTCStatsCollectorCallback* callback) {} | 647 virtual void GetStats(RTCStatsCollectorCallback* callback) {} |
496 | 648 |
| 649 // Create a data channel with the provided config, or default config if none |
| 650 // is provided. Note that an offer/answer negotiation is still necessary |
| 651 // before the data channel can be used. |
| 652 // |
| 653 // Also, calling CreateDataChannel is the only way to get a data "m=" section |
| 654 // in SDP, so it should be done before CreateOffer is called, if the |
| 655 // application plans to use data channels. |
497 virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( | 656 virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( |
498 const std::string& label, | 657 const std::string& label, |
499 const DataChannelInit* config) = 0; | 658 const DataChannelInit* config) = 0; |
500 | 659 |
| 660 // Returns the more recently applied description; "pending" if it exists, and |
| 661 // otherwise "current". See below. |
501 virtual const SessionDescriptionInterface* local_description() const = 0; | 662 virtual const SessionDescriptionInterface* local_description() const = 0; |
502 virtual const SessionDescriptionInterface* remote_description() const = 0; | 663 virtual const SessionDescriptionInterface* remote_description() const = 0; |
| 664 |
503 // A "current" description the one currently negotiated from a complete | 665 // A "current" description the one currently negotiated from a complete |
504 // offer/answer exchange. | 666 // offer/answer exchange. |
505 virtual const SessionDescriptionInterface* current_local_description() const { | 667 virtual const SessionDescriptionInterface* current_local_description() const { |
506 return nullptr; | 668 return nullptr; |
507 } | 669 } |
508 virtual const SessionDescriptionInterface* current_remote_description() | 670 virtual const SessionDescriptionInterface* current_remote_description() |
509 const { | 671 const { |
510 return nullptr; | 672 return nullptr; |
511 } | 673 } |
| 674 |
512 // A "pending" description is one that's part of an incomplete offer/answer | 675 // A "pending" description is one that's part of an incomplete offer/answer |
513 // exchange (thus, either an offer or a pranswer). Once the offer/answer | 676 // exchange (thus, either an offer or a pranswer). Once the offer/answer |
514 // exchange is finished, the "pending" description will become "current". | 677 // exchange is finished, the "pending" description will become "current". |
515 virtual const SessionDescriptionInterface* pending_local_description() const { | 678 virtual const SessionDescriptionInterface* pending_local_description() const { |
516 return nullptr; | 679 return nullptr; |
517 } | 680 } |
518 virtual const SessionDescriptionInterface* pending_remote_description() | 681 virtual const SessionDescriptionInterface* pending_remote_description() |
519 const { | 682 const { |
520 return nullptr; | 683 return nullptr; |
521 } | 684 } |
(...skipping 21 matching lines...) Expand all Loading... |
543 // Sets the local session description. | 706 // Sets the local session description. |
544 // JsepInterface takes the ownership of |desc| even if it fails. | 707 // JsepInterface takes the ownership of |desc| even if it fails. |
545 // The |observer| callback will be called when done. | 708 // The |observer| callback will be called when done. |
546 virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, | 709 virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, |
547 SessionDescriptionInterface* desc) = 0; | 710 SessionDescriptionInterface* desc) = 0; |
548 // Sets the remote session description. | 711 // Sets the remote session description. |
549 // JsepInterface takes the ownership of |desc| even if it fails. | 712 // JsepInterface takes the ownership of |desc| even if it fails. |
550 // The |observer| callback will be called when done. | 713 // The |observer| callback will be called when done. |
551 virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, | 714 virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
552 SessionDescriptionInterface* desc) = 0; | 715 SessionDescriptionInterface* desc) = 0; |
553 // Restarts or updates the ICE Agent process of gathering local candidates | 716 // Deprecated; Replaced by SetConfiguration. |
554 // and pinging remote candidates. | |
555 // TODO(deadbeef): Remove once Chrome is moved over to SetConfiguration. | 717 // TODO(deadbeef): Remove once Chrome is moved over to SetConfiguration. |
556 virtual bool UpdateIce(const IceServers& configuration, | 718 virtual bool UpdateIce(const IceServers& configuration, |
557 const MediaConstraintsInterface* constraints) { | 719 const MediaConstraintsInterface* constraints) { |
558 return false; | 720 return false; |
559 } | 721 } |
560 virtual bool UpdateIce(const IceServers& configuration) { return false; } | 722 virtual bool UpdateIce(const IceServers& configuration) { return false; } |
| 723 |
561 // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of | 724 // TODO(deadbeef): Make this pure virtual once all Chrome subclasses of |
562 // PeerConnectionInterface implement it. | 725 // PeerConnectionInterface implement it. |
563 virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() { | 726 virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() { |
564 return PeerConnectionInterface::RTCConfiguration(); | 727 return PeerConnectionInterface::RTCConfiguration(); |
565 } | 728 } |
566 | 729 |
567 // Sets the PeerConnection's global configuration to |config|. | 730 // Sets the PeerConnection's global configuration to |config|. |
568 // | 731 // |
569 // The members of |config| that may be changed are |type|, |servers|, | 732 // The members of |config| that may be changed are |type|, |servers|, |
570 // |ice_candidate_pool_size| and |prune_turn_ports| (though the candidate | 733 // |ice_candidate_pool_size| and |prune_turn_ports| (though the candidate |
(...skipping 20 matching lines...) Expand all Loading... |
591 const PeerConnectionInterface::RTCConfiguration& config, | 754 const PeerConnectionInterface::RTCConfiguration& config, |
592 RTCError* error) { | 755 RTCError* error) { |
593 return false; | 756 return false; |
594 } | 757 } |
595 // Version without error output param for backwards compatibility. | 758 // Version without error output param for backwards compatibility. |
596 // TODO(deadbeef): Remove once chromium is updated. | 759 // TODO(deadbeef): Remove once chromium is updated. |
597 virtual bool SetConfiguration( | 760 virtual bool SetConfiguration( |
598 const PeerConnectionInterface::RTCConfiguration& config) { | 761 const PeerConnectionInterface::RTCConfiguration& config) { |
599 return false; | 762 return false; |
600 } | 763 } |
| 764 |
601 // Provides a remote candidate to the ICE Agent. | 765 // Provides a remote candidate to the ICE Agent. |
602 // A copy of the |candidate| will be created and added to the remote | 766 // A copy of the |candidate| will be created and added to the remote |
603 // description. So the caller of this method still has the ownership of the | 767 // description. So the caller of this method still has the ownership of the |
604 // |candidate|. | 768 // |candidate|. |
605 // TODO(ronghuawu): Consider to change this so that the AddIceCandidate will | |
606 // take the ownership of the |candidate|. | |
607 virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0; | 769 virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0; |
608 | 770 |
609 // Removes a group of remote candidates from the ICE agent. | 771 // Removes a group of remote candidates from the ICE agent. Needed mainly for |
| 772 // continual gathering, to avoid an ever-growing list of candidates as |
| 773 // networks come and go. |
610 virtual bool RemoveIceCandidates( | 774 virtual bool RemoveIceCandidates( |
611 const std::vector<cricket::Candidate>& candidates) { | 775 const std::vector<cricket::Candidate>& candidates) { |
612 return false; | 776 return false; |
613 } | 777 } |
614 | 778 |
| 779 // Register a metric observer (used by chromium). |
| 780 // |
| 781 // There can only be one observer at a time. Before the observer is |
| 782 // destroyed, RegisterUMAOberver(nullptr) should be called. |
615 virtual void RegisterUMAObserver(UMAObserver* observer) = 0; | 783 virtual void RegisterUMAObserver(UMAObserver* observer) = 0; |
616 | 784 |
617 // Returns the current SignalingState. | 785 // Returns the current SignalingState. |
618 virtual SignalingState signaling_state() = 0; | 786 virtual SignalingState signaling_state() = 0; |
619 virtual IceConnectionState ice_connection_state() = 0; | 787 virtual IceConnectionState ice_connection_state() = 0; |
620 virtual IceGatheringState ice_gathering_state() = 0; | 788 virtual IceGatheringState ice_gathering_state() = 0; |
621 | 789 |
622 // Starts RtcEventLog using existing file. Takes ownership of |file| and | 790 // Starts RtcEventLog using existing file. Takes ownership of |file| and |
623 // passes it on to Call, which will take the ownership. If the | 791 // passes it on to Call, which will take the ownership. If the |
624 // operation fails the file will be closed. The logging will stop | 792 // operation fails the file will be closed. The logging will stop |
625 // automatically after 10 minutes have passed, or when the StopRtcEventLog | 793 // automatically after 10 minutes have passed, or when the StopRtcEventLog |
626 // function is called. | 794 // function is called. |
627 // TODO(ivoc): Make this pure virtual when Chrome is updated. | 795 // TODO(ivoc): Make this pure virtual when Chrome is updated. |
628 virtual bool StartRtcEventLog(rtc::PlatformFile file, | 796 virtual bool StartRtcEventLog(rtc::PlatformFile file, |
629 int64_t max_size_bytes) { | 797 int64_t max_size_bytes) { |
630 return false; | 798 return false; |
631 } | 799 } |
632 | 800 |
633 // Stops logging the RtcEventLog. | 801 // Stops logging the RtcEventLog. |
634 // TODO(ivoc): Make this pure virtual when Chrome is updated. | 802 // TODO(ivoc): Make this pure virtual when Chrome is updated. |
635 virtual void StopRtcEventLog() {} | 803 virtual void StopRtcEventLog() {} |
636 | 804 |
637 // Terminates all media and closes the transport. | 805 // Terminates all media, closes the transports, and in general releases any |
| 806 // resources used by the PeerConnection. This is an irreversible operation. |
638 virtual void Close() = 0; | 807 virtual void Close() = 0; |
639 | 808 |
640 protected: | 809 protected: |
641 // Dtor protected as objects shouldn't be deleted via this interface. | 810 // Dtor protected as objects shouldn't be deleted via this interface. |
642 ~PeerConnectionInterface() {} | 811 ~PeerConnectionInterface() {} |
643 }; | 812 }; |
644 | 813 |
645 // PeerConnection callback interface. Application should implement these | 814 // PeerConnection callback interface, used for RTCPeerConnection events. |
646 // methods. | 815 // Application should implement these methods. |
647 class PeerConnectionObserver { | 816 class PeerConnectionObserver { |
648 public: | 817 public: |
649 enum StateType { | 818 enum StateType { |
650 kSignalingState, | 819 kSignalingState, |
651 kIceState, | 820 kIceState, |
652 }; | 821 }; |
653 | 822 |
654 // Triggered when the SignalingState changed. | 823 // Triggered when the SignalingState changed. |
655 virtual void OnSignalingChange( | 824 virtual void OnSignalingChange( |
656 PeerConnectionInterface::SignalingState new_state) = 0; | 825 PeerConnectionInterface::SignalingState new_state) = 0; |
(...skipping 17 matching lines...) Expand all Loading... |
674 virtual void OnDataChannel( | 843 virtual void OnDataChannel( |
675 rtc::scoped_refptr<DataChannelInterface> data_channel) {} | 844 rtc::scoped_refptr<DataChannelInterface> data_channel) {} |
676 // Deprecated; please use the version that uses a scoped_refptr. | 845 // Deprecated; please use the version that uses a scoped_refptr. |
677 virtual void OnDataChannel(DataChannelInterface* data_channel) {} | 846 virtual void OnDataChannel(DataChannelInterface* data_channel) {} |
678 | 847 |
679 // Triggered when renegotiation is needed. For example, an ICE restart | 848 // Triggered when renegotiation is needed. For example, an ICE restart |
680 // has begun. | 849 // has begun. |
681 virtual void OnRenegotiationNeeded() = 0; | 850 virtual void OnRenegotiationNeeded() = 0; |
682 | 851 |
683 // Called any time the IceConnectionState changes. | 852 // Called any time the IceConnectionState changes. |
| 853 // |
| 854 // Note that our ICE states lag behind the standard slightly. The most |
| 855 // notable differences include the fact that "failed" occurs after 15 |
| 856 // seconds, not 30, and this actually represents a combination ICE + DTLS |
| 857 // state, so it may be "failed" if DTLS fails while ICE succeeds. |
684 virtual void OnIceConnectionChange( | 858 virtual void OnIceConnectionChange( |
685 PeerConnectionInterface::IceConnectionState new_state) = 0; | 859 PeerConnectionInterface::IceConnectionState new_state) = 0; |
686 | 860 |
687 // Called any time the IceGatheringState changes. | 861 // Called any time the IceGatheringState changes. |
688 virtual void OnIceGatheringChange( | 862 virtual void OnIceGatheringChange( |
689 PeerConnectionInterface::IceGatheringState new_state) = 0; | 863 PeerConnectionInterface::IceGatheringState new_state) = 0; |
690 | 864 |
691 // A new ICE candidate has been gathered. | 865 // A new ICE candidate has been gathered. |
692 virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; | 866 virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0; |
693 | 867 |
(...skipping 11 matching lines...) Expand all Loading... |
705 // implement it. | 879 // implement it. |
706 virtual void OnAddTrack( | 880 virtual void OnAddTrack( |
707 rtc::scoped_refptr<RtpReceiverInterface> receiver, | 881 rtc::scoped_refptr<RtpReceiverInterface> receiver, |
708 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {} | 882 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {} |
709 | 883 |
710 protected: | 884 protected: |
711 // Dtor protected as objects shouldn't be deleted via this interface. | 885 // Dtor protected as objects shouldn't be deleted via this interface. |
712 ~PeerConnectionObserver() {} | 886 ~PeerConnectionObserver() {} |
713 }; | 887 }; |
714 | 888 |
715 // PeerConnectionFactoryInterface is the factory interface use for creating | 889 // PeerConnectionFactoryInterface is the factory interface used for creating |
716 // PeerConnection, MediaStream and media tracks. | 890 // PeerConnection, MediaStream and MediaStreamTrack objects. |
717 // PeerConnectionFactoryInterface will create required libjingle threads, | 891 // |
718 // socket and network manager factory classes for networking. | 892 // The simplest method for obtaiing one, CreatePeerConnectionFactory will |
719 // If an application decides to provide its own threads and network | 893 // create the required libjingle threads, socket and network manager factory |
720 // implementation of these classes it should use the alternate | 894 // classes for networking if none are provided, though it requires that the |
721 // CreatePeerConnectionFactory method which accepts threads as input and use the | 895 // application runs a message loop on the thread that called the method (see |
722 // CreatePeerConnection version that takes a PortAllocator as an | 896 // explanation below) |
723 // argument. | 897 // |
| 898 // If an application decides to provide its own threads and/or implementation |
| 899 // of networking classes, it should use the alternate |
| 900 // CreatePeerConnectionFactory method which accepts threads as input, and use |
| 901 // the CreatePeerConnection version that takes a PortAllocator as an argument. |
724 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { | 902 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { |
725 public: | 903 public: |
726 class Options { | 904 class Options { |
727 public: | 905 public: |
728 Options() | 906 Options() : crypto_options(rtc::CryptoOptions::NoGcm()) {} |
729 : disable_encryption(false), | 907 |
730 disable_sctp_data_channels(false), | 908 // If set to true, created PeerConnections won't enforce any SRTP |
731 disable_network_monitor(false), | 909 // requirement, allowing unsecured media. Should only be used for |
732 network_ignore_mask(rtc::kDefaultNetworkIgnoreMask), | 910 // testing/debugging. |
733 ssl_max_version(rtc::SSL_PROTOCOL_DTLS_12), | 911 bool disable_encryption = false; |
734 crypto_options(rtc::CryptoOptions::NoGcm()) {} | 912 |
735 bool disable_encryption; | 913 // Deprecated. The only effect of setting this to true is that |
736 bool disable_sctp_data_channels; | 914 // CreateDataChannel will fail, which is not that useful. |
737 bool disable_network_monitor; | 915 bool disable_sctp_data_channels = false; |
| 916 |
| 917 // If set to true, any platform-supported network monitoring capability |
| 918 // won't be used, and instead networks will only be updated via polling. |
| 919 // |
| 920 // This only has an effect if a PeerConnection is created with the default |
| 921 // PortAllocator implementation. |
| 922 bool disable_network_monitor = false; |
738 | 923 |
739 // Sets the network types to ignore. For instance, calling this with | 924 // Sets the network types to ignore. For instance, calling this with |
740 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and | 925 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and |
741 // loopback interfaces. | 926 // loopback interfaces. |
742 int network_ignore_mask; | 927 int network_ignore_mask = rtc::kDefaultNetworkIgnoreMask; |
743 | 928 |
744 // Sets the maximum supported protocol version. The highest version | 929 // Sets the maximum supported protocol version. The highest version |
745 // supported by both ends will be used for the connection, i.e. if one | 930 // supported by both ends will be used for the connection, i.e. if one |
746 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. | 931 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. |
747 rtc::SSLProtocolVersion ssl_max_version; | 932 rtc::SSLProtocolVersion ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
748 | 933 |
749 // Sets crypto related options, e.g. enabled cipher suites. | 934 // Sets crypto related options, e.g. enabled cipher suites. |
750 rtc::CryptoOptions crypto_options; | 935 rtc::CryptoOptions crypto_options; |
751 }; | 936 }; |
752 | 937 |
753 virtual void SetOptions(const Options& options) = 0; | 938 virtual void SetOptions(const Options& options) = 0; |
754 | 939 |
755 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( | 940 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
756 const PeerConnectionInterface::RTCConfiguration& configuration, | 941 const PeerConnectionInterface::RTCConfiguration& configuration, |
| 942 std::unique_ptr<cricket::PortAllocator> allocator, |
| 943 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, |
| 944 PeerConnectionObserver* observer) = 0; |
| 945 |
| 946 // Deprecated; should use RTCConfiguration for everything that previously |
| 947 // used constraints. |
| 948 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 949 const PeerConnectionInterface::RTCConfiguration& configuration, |
757 const MediaConstraintsInterface* constraints, | 950 const MediaConstraintsInterface* constraints, |
758 std::unique_ptr<cricket::PortAllocator> allocator, | 951 std::unique_ptr<cricket::PortAllocator> allocator, |
759 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, | 952 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, |
760 PeerConnectionObserver* observer) = 0; | 953 PeerConnectionObserver* observer) = 0; |
761 | |
762 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( | |
763 const PeerConnectionInterface::RTCConfiguration& configuration, | |
764 std::unique_ptr<cricket::PortAllocator> allocator, | |
765 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, | |
766 PeerConnectionObserver* observer) = 0; | |
767 | 954 |
768 virtual rtc::scoped_refptr<MediaStreamInterface> | 955 virtual rtc::scoped_refptr<MediaStreamInterface> |
769 CreateLocalMediaStream(const std::string& label) = 0; | 956 CreateLocalMediaStream(const std::string& label) = 0; |
770 | 957 |
771 // Creates a AudioSourceInterface. | 958 // Creates a AudioSourceInterface. |
772 // |constraints| decides audio processing settings but can be NULL. | 959 // |options| decides audio processing settings. |
773 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( | 960 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
774 const cricket::AudioOptions& options) = 0; | 961 const cricket::AudioOptions& options) = 0; |
775 // Deprecated - use version above. | 962 // Deprecated - use version above. |
776 // Can use CopyConstraintsIntoAudioOptions to bridge the gap. | 963 // Can use CopyConstraintsIntoAudioOptions to bridge the gap. |
777 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( | 964 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
778 const MediaConstraintsInterface* constraints) = 0; | 965 const MediaConstraintsInterface* constraints) = 0; |
779 | 966 |
780 // Creates a VideoTrackSourceInterface. The new source take ownership of | 967 // Creates a VideoTrackSourceInterface. The new source takes ownership of |
781 // |capturer|. | 968 // |capturer|. |
| 969 // TODO(deadbeef): Switch to std::unique_ptr<>, to make this transfership of |
| 970 // ownership more clear. |
782 virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( | 971 virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( |
783 cricket::VideoCapturer* capturer) = 0; | 972 cricket::VideoCapturer* capturer) = 0; |
784 // A video source creator that allows selection of resolution and frame rate. | 973 // A video source creator that allows selection of resolution and frame rate. |
785 // |constraints| decides video resolution and frame rate but can | 974 // |constraints| decides video resolution and frame rate but can be NULL. |
786 // be NULL. | |
787 // In the NULL case, use the version above. | 975 // In the NULL case, use the version above. |
788 virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( | 976 virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( |
789 cricket::VideoCapturer* capturer, | 977 cricket::VideoCapturer* capturer, |
790 const MediaConstraintsInterface* constraints) = 0; | 978 const MediaConstraintsInterface* constraints) = 0; |
791 | 979 |
792 // Creates a new local VideoTrack. The same |source| can be used in several | 980 // Creates a new local VideoTrack. The same |source| can be used in several |
793 // tracks. | 981 // tracks. |
794 virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack( | 982 virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack( |
795 const std::string& label, | 983 const std::string& label, |
796 VideoTrackSourceInterface* source) = 0; | 984 VideoTrackSourceInterface* source) = 0; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 // Deprecated variant of the above. | 1047 // Deprecated variant of the above. |
860 // TODO(kwiberg): Remove. | 1048 // TODO(kwiberg): Remove. |
861 rtc::scoped_refptr<PeerConnectionFactoryInterface> | 1049 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
862 CreatePeerConnectionFactory(); | 1050 CreatePeerConnectionFactory(); |
863 | 1051 |
864 // Create a new instance of PeerConnectionFactoryInterface. | 1052 // Create a new instance of PeerConnectionFactoryInterface. |
865 // | 1053 // |
866 // |network_thread|, |worker_thread| and |signaling_thread| are | 1054 // |network_thread|, |worker_thread| and |signaling_thread| are |
867 // the only mandatory parameters. | 1055 // the only mandatory parameters. |
868 // | 1056 // |
869 // If non-null, ownership of |default_adm|, |encoder_factory| and | 1057 // If non-null, a reference is added to |default_adm|, and ownership of |
870 // |decoder_factory| are transferred to the returned factory. | 1058 // |video_encoder_factory| and |video_decoder_factory| is transferred to the |
| 1059 // returned factory. |
| 1060 // TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this |
| 1061 // ownership transfer and ref counting more obvious. |
871 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( | 1062 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
872 rtc::Thread* network_thread, | 1063 rtc::Thread* network_thread, |
873 rtc::Thread* worker_thread, | 1064 rtc::Thread* worker_thread, |
874 rtc::Thread* signaling_thread, | 1065 rtc::Thread* signaling_thread, |
875 AudioDeviceModule* default_adm, | 1066 AudioDeviceModule* default_adm, |
876 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, | 1067 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
877 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, | 1068 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
878 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 1069 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
879 cricket::WebRtcVideoDecoderFactory* video_decoder_factory); | 1070 cricket::WebRtcVideoDecoderFactory* video_decoder_factory); |
880 | 1071 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 1134 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
944 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 1135 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
945 return CreatePeerConnectionFactory( | 1136 return CreatePeerConnectionFactory( |
946 worker_and_network_thread, worker_and_network_thread, signaling_thread, | 1137 worker_and_network_thread, worker_and_network_thread, signaling_thread, |
947 default_adm, encoder_factory, decoder_factory); | 1138 default_adm, encoder_factory, decoder_factory); |
948 } | 1139 } |
949 | 1140 |
950 } // namespace webrtc | 1141 } // namespace webrtc |
951 | 1142 |
952 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 1143 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
OLD | NEW |