| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 std::string MediaTypeToString(MediaType type); | 46 std::string MediaTypeToString(MediaType type); |
| 47 | 47 |
| 48 enum MediaContentDirection { | 48 enum MediaContentDirection { |
| 49 MD_INACTIVE, | 49 MD_INACTIVE, |
| 50 MD_SENDONLY, | 50 MD_SENDONLY, |
| 51 MD_RECVONLY, | 51 MD_RECVONLY, |
| 52 MD_SENDRECV | 52 MD_SENDRECV |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 std::string MediaContentDirectionToString(MediaContentDirection direction); |
| 56 |
| 55 enum CryptoType { | 57 enum CryptoType { |
| 56 CT_NONE, | 58 CT_NONE, |
| 57 CT_SDES, | 59 CT_SDES, |
| 58 CT_DTLS | 60 CT_DTLS |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 // RTC4585 RTP/AVPF | 63 // RTC4585 RTP/AVPF |
| 62 extern const char kMediaProtocolAvpf[]; | 64 extern const char kMediaProtocolAvpf[]; |
| 63 // RFC5124 RTP/SAVPF | 65 // RFC5124 RTP/SAVPF |
| 64 extern const char kMediaProtocolSavpf[]; | 66 extern const char kMediaProtocolSavpf[]; |
| 65 | 67 |
| 66 extern const char kMediaProtocolDtlsSavpf[]; | 68 extern const char kMediaProtocolDtlsSavpf[]; |
| 67 | 69 |
| 68 extern const char kMediaProtocolRtpPrefix[]; | 70 extern const char kMediaProtocolRtpPrefix[]; |
| 69 | 71 |
| 70 extern const char kMediaProtocolSctp[]; | 72 extern const char kMediaProtocolSctp[]; |
| 71 extern const char kMediaProtocolDtlsSctp[]; | 73 extern const char kMediaProtocolDtlsSctp[]; |
| 72 extern const char kMediaProtocolUdpDtlsSctp[]; | 74 extern const char kMediaProtocolUdpDtlsSctp[]; |
| 73 extern const char kMediaProtocolTcpDtlsSctp[]; | 75 extern const char kMediaProtocolTcpDtlsSctp[]; |
| 74 | 76 |
| 75 // Options to control how session descriptions are generated. | 77 // Options to control how session descriptions are generated. |
| 76 const int kAutoBandwidth = -1; | 78 const int kAutoBandwidth = -1; |
| 77 const int kBufferedModeDisabled = 0; | 79 const int kBufferedModeDisabled = 0; |
| 78 | 80 |
| 79 // Default RTCP CNAME for unit tests. | 81 // Default RTCP CNAME for unit tests. |
| 80 const char kDefaultRtcpCname[] = "DefaultRtcpCname"; | 82 const char kDefaultRtcpCname[] = "DefaultRtcpCname"; |
| 81 | 83 |
| 84 struct RtpTransceiverDirection { |
| 85 bool send; |
| 86 bool recv; |
| 87 |
| 88 RtpTransceiverDirection(bool send, bool recv) : send(send), recv(recv) {} |
| 89 |
| 90 bool operator==(const RtpTransceiverDirection& o) const { |
| 91 return send == o.send && recv == o.recv; |
| 92 } |
| 93 |
| 94 bool operator!=(const RtpTransceiverDirection& o) const { |
| 95 return !(*this == o); |
| 96 } |
| 97 |
| 98 static RtpTransceiverDirection FromMediaContentDirection( |
| 99 MediaContentDirection md); |
| 100 |
| 101 MediaContentDirection ToMediaContentDirection() const; |
| 102 }; |
| 103 |
| 104 RtpTransceiverDirection |
| 105 NegotiateRtpTransceiverDirection(RtpTransceiverDirection offer, |
| 106 RtpTransceiverDirection wants); |
| 107 |
| 82 struct MediaSessionOptions { | 108 struct MediaSessionOptions { |
| 83 MediaSessionOptions() | 109 MediaSessionOptions() |
| 84 : recv_audio(true), | 110 : recv_audio(true), |
| 85 recv_video(false), | 111 recv_video(false), |
| 86 data_channel_type(DCT_NONE), | 112 data_channel_type(DCT_NONE), |
| 87 is_muc(false), | 113 is_muc(false), |
| 88 vad_enabled(true), // When disabled, removes all CN codecs from SDP. | 114 vad_enabled(true), // When disabled, removes all CN codecs from SDP. |
| 89 rtcp_mux_enabled(true), | 115 rtcp_mux_enabled(true), |
| 90 bundle_enabled(false), | 116 bundle_enabled(false), |
| 91 video_bandwidth(kAutoBandwidth), | 117 video_bandwidth(kAutoBandwidth), |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // Default ctor; use methods below to set configuration. | 414 // Default ctor; use methods below to set configuration. |
| 389 // The TransportDescriptionFactory is not owned by MediaSessionDescFactory, | 415 // The TransportDescriptionFactory is not owned by MediaSessionDescFactory, |
| 390 // so it must be kept alive by the user of this class. | 416 // so it must be kept alive by the user of this class. |
| 391 explicit MediaSessionDescriptionFactory( | 417 explicit MediaSessionDescriptionFactory( |
| 392 const TransportDescriptionFactory* factory); | 418 const TransportDescriptionFactory* factory); |
| 393 // This helper automatically sets up the factory to get its configuration | 419 // This helper automatically sets up the factory to get its configuration |
| 394 // from the specified ChannelManager. | 420 // from the specified ChannelManager. |
| 395 MediaSessionDescriptionFactory(ChannelManager* cmanager, | 421 MediaSessionDescriptionFactory(ChannelManager* cmanager, |
| 396 const TransportDescriptionFactory* factory); | 422 const TransportDescriptionFactory* factory); |
| 397 | 423 |
| 398 const AudioCodecs& audio_codecs() const { return audio_codecs_; } | 424 const AudioCodecs& audio_codecs() const; |
| 399 void set_audio_codecs(const AudioCodecs& codecs) { audio_codecs_ = codecs; } | 425 const AudioCodecs& audio_send_codecs() const; |
| 426 const AudioCodecs& audio_recv_codecs() const; |
| 427 void set_audio_codecs(const AudioCodecs& send_codecs, |
| 428 const AudioCodecs& recv_codecs); |
| 400 void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) { | 429 void set_audio_rtp_header_extensions(const RtpHeaderExtensions& extensions) { |
| 401 audio_rtp_extensions_ = extensions; | 430 audio_rtp_extensions_ = extensions; |
| 402 } | 431 } |
| 403 const RtpHeaderExtensions& audio_rtp_header_extensions() const { | 432 const RtpHeaderExtensions& audio_rtp_header_extensions() const { |
| 404 return audio_rtp_extensions_; | 433 return audio_rtp_extensions_; |
| 405 } | 434 } |
| 406 const VideoCodecs& video_codecs() const { return video_codecs_; } | 435 const VideoCodecs& video_codecs() const { return video_codecs_; } |
| 407 void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; } | 436 void set_video_codecs(const VideoCodecs& codecs) { video_codecs_ = codecs; } |
| 408 void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) { | 437 void set_video_rtp_header_extensions(const RtpHeaderExtensions& extensions) { |
| 409 video_rtp_extensions_ = extensions; | 438 video_rtp_extensions_ = extensions; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 423 | 452 |
| 424 SessionDescription* CreateOffer( | 453 SessionDescription* CreateOffer( |
| 425 const MediaSessionOptions& options, | 454 const MediaSessionOptions& options, |
| 426 const SessionDescription* current_description) const; | 455 const SessionDescription* current_description) const; |
| 427 SessionDescription* CreateAnswer( | 456 SessionDescription* CreateAnswer( |
| 428 const SessionDescription* offer, | 457 const SessionDescription* offer, |
| 429 const MediaSessionOptions& options, | 458 const MediaSessionOptions& options, |
| 430 const SessionDescription* current_description) const; | 459 const SessionDescription* current_description) const; |
| 431 | 460 |
| 432 private: | 461 private: |
| 462 const AudioCodecs& GetAudioCodecsForOffer( |
| 463 const RtpTransceiverDirection& direction) const; |
| 464 const AudioCodecs& GetAudioCodecsForAnswer( |
| 465 const RtpTransceiverDirection& offer, |
| 466 const RtpTransceiverDirection& answer) const; |
| 433 void GetCodecsToOffer(const SessionDescription* current_description, | 467 void GetCodecsToOffer(const SessionDescription* current_description, |
| 468 const AudioCodecs& supported_audio_codecs, |
| 469 const VideoCodecs& supported_video_codecs, |
| 470 const DataCodecs& supported_data_codecs, |
| 434 AudioCodecs* audio_codecs, | 471 AudioCodecs* audio_codecs, |
| 435 VideoCodecs* video_codecs, | 472 VideoCodecs* video_codecs, |
| 436 DataCodecs* data_codecs) const; | 473 DataCodecs* data_codecs) const; |
| 437 void GetRtpHdrExtsToOffer(const SessionDescription* current_description, | 474 void GetRtpHdrExtsToOffer(const SessionDescription* current_description, |
| 438 RtpHeaderExtensions* audio_extensions, | 475 RtpHeaderExtensions* audio_extensions, |
| 439 RtpHeaderExtensions* video_extensions) const; | 476 RtpHeaderExtensions* video_extensions) const; |
| 440 bool AddTransportOffer( | 477 bool AddTransportOffer( |
| 441 const std::string& content_name, | 478 const std::string& content_name, |
| 442 const TransportOptions& transport_options, | 479 const TransportOptions& transport_options, |
| 443 const SessionDescription* current_desc, | 480 const SessionDescription* current_desc, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 StreamParamsVec* current_streams, | 532 StreamParamsVec* current_streams, |
| 496 SessionDescription* answer) const; | 533 SessionDescription* answer) const; |
| 497 | 534 |
| 498 bool AddDataContentForAnswer( | 535 bool AddDataContentForAnswer( |
| 499 const SessionDescription* offer, | 536 const SessionDescription* offer, |
| 500 const MediaSessionOptions& options, | 537 const MediaSessionOptions& options, |
| 501 const SessionDescription* current_description, | 538 const SessionDescription* current_description, |
| 502 StreamParamsVec* current_streams, | 539 StreamParamsVec* current_streams, |
| 503 SessionDescription* answer) const; | 540 SessionDescription* answer) const; |
| 504 | 541 |
| 505 AudioCodecs audio_codecs_; | 542 AudioCodecs audio_send_codecs_; |
| 543 AudioCodecs audio_recv_codecs_; |
| 544 AudioCodecs audio_sendrecv_codecs_; |
| 506 RtpHeaderExtensions audio_rtp_extensions_; | 545 RtpHeaderExtensions audio_rtp_extensions_; |
| 507 VideoCodecs video_codecs_; | 546 VideoCodecs video_codecs_; |
| 508 RtpHeaderExtensions video_rtp_extensions_; | 547 RtpHeaderExtensions video_rtp_extensions_; |
| 509 DataCodecs data_codecs_; | 548 DataCodecs data_codecs_; |
| 510 SecurePolicy secure_; | 549 SecurePolicy secure_; |
| 511 bool add_legacy_; | 550 bool add_legacy_; |
| 512 std::string lang_; | 551 std::string lang_; |
| 513 const TransportDescriptionFactory* transport_desc_factory_; | 552 const TransportDescriptionFactory* transport_desc_factory_; |
| 514 }; | 553 }; |
| 515 | 554 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 542 void GetSupportedVideoCryptoSuiteNames( | 581 void GetSupportedVideoCryptoSuiteNames( |
| 543 std::vector<std::string>* crypto_suite_names); | 582 std::vector<std::string>* crypto_suite_names); |
| 544 void GetSupportedDataCryptoSuiteNames( | 583 void GetSupportedDataCryptoSuiteNames( |
| 545 std::vector<std::string>* crypto_suite_names); | 584 std::vector<std::string>* crypto_suite_names); |
| 546 void GetDefaultSrtpCryptoSuiteNames( | 585 void GetDefaultSrtpCryptoSuiteNames( |
| 547 std::vector<std::string>* crypto_suite_names); | 586 std::vector<std::string>* crypto_suite_names); |
| 548 | 587 |
| 549 } // namespace cricket | 588 } // namespace cricket |
| 550 | 589 |
| 551 #endif // WEBRTC_PC_MEDIASESSION_H_ | 590 #endif // WEBRTC_PC_MEDIASESSION_H_ |
| OLD | NEW |