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