OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 ost << "}"; | 835 ost << "}"; |
836 return ost.str(); | 836 return ost.str(); |
837 } | 837 } |
838 | 838 |
839 std::vector<Codec> codecs; | 839 std::vector<Codec> codecs; |
840 std::vector<RtpHeaderExtension> extensions; | 840 std::vector<RtpHeaderExtension> extensions; |
841 // TODO(pthatcher): Add streams. | 841 // TODO(pthatcher): Add streams. |
842 RtcpParameters rtcp; | 842 RtcpParameters rtcp; |
843 }; | 843 }; |
844 | 844 |
845 template <class Codec, class Options> | 845 template <class Codec> |
846 struct RtpSendParameters : RtpParameters<Codec> { | 846 struct RtpSendParameters : RtpParameters<Codec> { |
847 std::string ToString() const override { | 847 std::string ToString() const override { |
848 std::ostringstream ost; | 848 std::ostringstream ost; |
849 ost << "{"; | 849 ost << "{"; |
850 ost << "codecs: " << VectorToString(this->codecs) << ", "; | 850 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
851 ost << "extensions: " << VectorToString(this->extensions) << ", "; | 851 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
852 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; | 852 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; |
| 853 ost << "}"; |
| 854 return ost.str(); |
| 855 } |
| 856 |
| 857 int max_bandwidth_bps = -1; |
| 858 }; |
| 859 |
| 860 struct AudioSendParameters : RtpSendParameters<AudioCodec> { |
| 861 std::string ToString() const override { |
| 862 std::ostringstream ost; |
| 863 ost << "{"; |
| 864 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
| 865 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
| 866 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; |
853 ost << "options: " << options.ToString(); | 867 ost << "options: " << options.ToString(); |
854 ost << "}"; | 868 ost << "}"; |
855 return ost.str(); | 869 return ost.str(); |
856 } | 870 } |
857 | 871 |
858 int max_bandwidth_bps = -1; | 872 AudioOptions options; |
859 Options options; | |
860 }; | |
861 | |
862 struct AudioSendParameters : RtpSendParameters<AudioCodec, AudioOptions> { | |
863 }; | 873 }; |
864 | 874 |
865 struct AudioRecvParameters : RtpParameters<AudioCodec> { | 875 struct AudioRecvParameters : RtpParameters<AudioCodec> { |
866 }; | 876 }; |
867 | 877 |
868 class VoiceMediaChannel : public MediaChannel { | 878 class VoiceMediaChannel : public MediaChannel { |
869 public: | 879 public: |
870 enum Error { | 880 enum Error { |
871 ERROR_NONE = 0, // No error. | 881 ERROR_NONE = 0, // No error. |
872 ERROR_OTHER, // Other errors. | 882 ERROR_OTHER, // Other errors. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 // DTMF event 0-9, *, #, A-D. | 932 // DTMF event 0-9, *, #, A-D. |
923 virtual bool InsertDtmf(uint32_t ssrc, int event, int duration) = 0; | 933 virtual bool InsertDtmf(uint32_t ssrc, int event, int duration) = 0; |
924 // Gets quality stats for the channel. | 934 // Gets quality stats for the channel. |
925 virtual bool GetStats(VoiceMediaInfo* info) = 0; | 935 virtual bool GetStats(VoiceMediaInfo* info) = 0; |
926 | 936 |
927 virtual void SetRawAudioSink( | 937 virtual void SetRawAudioSink( |
928 uint32_t ssrc, | 938 uint32_t ssrc, |
929 std::unique_ptr<webrtc::AudioSinkInterface> sink) = 0; | 939 std::unique_ptr<webrtc::AudioSinkInterface> sink) = 0; |
930 }; | 940 }; |
931 | 941 |
932 struct VideoSendParameters : RtpSendParameters<VideoCodec, VideoOptions> { | 942 struct VideoSendParameters : RtpSendParameters<VideoCodec> { |
933 // Use conference mode? This flag comes from the remote | 943 // Use conference mode? This flag comes from the remote |
934 // description's SDP line 'a=x-google-flag:conference', copied over | 944 // description's SDP line 'a=x-google-flag:conference', copied over |
935 // by VideoChannel::SetRemoteContent_w, and ultimately used by | 945 // by VideoChannel::SetRemoteContent_w, and ultimately used by |
936 // conference mode screencast logic in | 946 // conference mode screencast logic in |
937 // WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig. | 947 // WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig. |
938 // The special screencast behaviour is disabled by default. | 948 // The special screencast behaviour is disabled by default. |
939 bool conference_mode = false; | 949 bool conference_mode = false; |
940 }; | 950 }; |
941 | 951 |
942 struct VideoRecvParameters : RtpParameters<VideoCodec> { | 952 struct VideoRecvParameters : RtpParameters<VideoCodec> { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 // TODO(pthatcher): Make these true by default? | 1053 // TODO(pthatcher): Make these true by default? |
1044 ordered(false), | 1054 ordered(false), |
1045 reliable(false), | 1055 reliable(false), |
1046 max_rtx_count(0), | 1056 max_rtx_count(0), |
1047 max_rtx_ms(0) { | 1057 max_rtx_ms(0) { |
1048 } | 1058 } |
1049 }; | 1059 }; |
1050 | 1060 |
1051 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; | 1061 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; |
1052 | 1062 |
1053 struct DataOptions { | 1063 struct DataSendParameters : RtpSendParameters<DataCodec> { |
1054 std::string ToString() const { | |
1055 return "{}"; | |
1056 } | |
1057 }; | |
1058 | |
1059 struct DataSendParameters : RtpSendParameters<DataCodec, DataOptions> { | |
1060 std::string ToString() const { | 1064 std::string ToString() const { |
1061 std::ostringstream ost; | 1065 std::ostringstream ost; |
1062 // Options and extensions aren't used. | 1066 // Options and extensions aren't used. |
1063 ost << "{"; | 1067 ost << "{"; |
1064 ost << "codecs: " << VectorToString(codecs) << ", "; | 1068 ost << "codecs: " << VectorToString(codecs) << ", "; |
1065 ost << "max_bandwidth_bps: " << max_bandwidth_bps; | 1069 ost << "max_bandwidth_bps: " << max_bandwidth_bps; |
1066 ost << "}"; | 1070 ost << "}"; |
1067 return ost.str(); | 1071 return ost.str(); |
1068 } | 1072 } |
1069 }; | 1073 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 // Signal when the media channel is ready to send the stream. Arguments are: | 1109 // Signal when the media channel is ready to send the stream. Arguments are: |
1106 // writable(bool) | 1110 // writable(bool) |
1107 sigslot::signal1<bool> SignalReadyToSend; | 1111 sigslot::signal1<bool> SignalReadyToSend; |
1108 // Signal for notifying that the remote side has closed the DataChannel. | 1112 // Signal for notifying that the remote side has closed the DataChannel. |
1109 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1113 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1110 }; | 1114 }; |
1111 | 1115 |
1112 } // namespace cricket | 1116 } // namespace cricket |
1113 | 1117 |
1114 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1118 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |