Index: talk/media/base/mediachannel.h |
diff --git a/talk/media/base/mediachannel.h b/talk/media/base/mediachannel.h |
index e7af7a76aa6368529a26d0dc19e53eaac2956824..49df88743344eb01869c6a7f049c72b6cdb2fe52 100644 |
--- a/talk/media/base/mediachannel.h |
+++ b/talk/media/base/mediachannel.h |
@@ -138,6 +138,17 @@ static std::string ToStringIfSet(const char* key, const Settable<T>& val) { |
return str; |
} |
+template <class T> |
+static std::string VectorToString(const std::vector<T>& vals) { |
+ std::ostringstream ost; |
+ ost << "["; |
+ for (const T& val : vals) { |
+ ost << val.ToString() << ","; |
pbos-webrtc
2015/07/14 08:25:01
Don't add "," at the end.
pthatcher1
2015/07/16 10:47:11
Done.
|
+ } |
+ ost << "]"; |
+ return ost.str(); |
+} |
+ |
// Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine. |
// Used to be flags, but that makes it hard to selectively apply options. |
// We are moving all of the setting of options to structs like this, |
@@ -327,7 +338,6 @@ struct VideoOptions { |
change.system_low_adaptation_threshhold); |
system_high_adaptation_threshhold.SetFrom( |
change.system_high_adaptation_threshhold); |
- buffered_mode_latency.SetFrom(change.buffered_mode_latency); |
dscp.SetFrom(change.dscp); |
suspend_below_min_bitrate.SetFrom(change.suspend_below_min_bitrate); |
unsignalled_recv_stream_limit.SetFrom(change.unsignalled_recv_stream_limit); |
@@ -356,7 +366,7 @@ struct VideoOptions { |
o.system_low_adaptation_threshhold && |
system_high_adaptation_threshhold == |
o.system_high_adaptation_threshhold && |
- buffered_mode_latency == o.buffered_mode_latency && dscp == o.dscp && |
+ dscp == o.dscp && |
suspend_below_min_bitrate == o.suspend_below_min_bitrate && |
unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && |
use_simulcast_adapter == o.use_simulcast_adapter && |
@@ -385,7 +395,6 @@ struct VideoOptions { |
ost << ToStringIfSet("process", process_adaptation_threshhold); |
ost << ToStringIfSet("low", system_low_adaptation_threshhold); |
ost << ToStringIfSet("high", system_high_adaptation_threshhold); |
- ost << ToStringIfSet("buffered mode latency", buffered_mode_latency); |
ost << ToStringIfSet("dscp", dscp); |
ost << ToStringIfSet("suspend below min bitrate", |
suspend_below_min_bitrate); |
@@ -439,8 +448,6 @@ struct VideoOptions { |
Settable<float> system_low_adaptation_threshhold; |
// High threshhold for cpu adaptation. (Adapt down) |
Settable<float> system_high_adaptation_threshhold; |
- // Specify buffered mode latency in milliseconds. |
- Settable<int> buffered_mode_latency; |
// Set DSCP value for packet sent from video channel. |
Settable<bool> dscp; |
// Enable WebRTC suspension of video. No video frames will be sent when the |
@@ -457,9 +464,6 @@ struct VideoOptions { |
struct RtpHeaderExtension { |
RtpHeaderExtension() : id(0) {} |
RtpHeaderExtension(const std::string& u, int i) : uri(u), id(i) {} |
- std::string uri; |
- int id; |
- // TODO(juberti): SendRecv direction; |
bool operator==(const RtpHeaderExtension& ext) const { |
// id is a reserved word in objective-c. Therefore the id attribute has to |
@@ -467,6 +471,19 @@ struct RtpHeaderExtension { |
return this->id == ext.id && |
uri == ext.uri; |
} |
+ |
+ std::string ToString() const { |
+ std::ostringstream ost; |
+ ost << "{"; |
+ ost << "id: , " << id; |
+ ost << "uri: " << uri; |
+ ost << "}"; |
+ return ost.str(); |
+ } |
+ |
+ std::string uri; |
+ int id; |
+ // TODO(juberti): SendRecv direction; |
}; |
// Returns the named header extension if found among all extensions, NULL |
@@ -989,6 +1006,41 @@ struct DataMediaInfo { |
std::vector<DataReceiverInfo> receivers; |
}; |
+struct AudioSendParameters { |
+ std::string ToString() { |
+ std::ostringstream ost; |
+ ost << "{"; |
+ ost << "codecs: " << VectorToString(codecs) << ", "; |
+ ost << "extensions: " << VectorToString(extensions) << ", "; |
+ ost << "max_bandiwidth_bps: " << max_bandwidth_bps << ", "; |
+ ost << "options: " << options.ToString(); |
+ ost << "}"; |
+ return ost.str(); |
+ } |
+ |
+ std::vector<AudioCodec> codecs; |
+ std::vector<RtpHeaderExtension> extensions; |
+ // TODO(pthatcher): Move max_bandwidth_bps into AudioOptions. |
+ int max_bandwidth_bps; |
+ AudioOptions options; |
+ // TODO(pthatcher): Add "remote" streams. |
+}; |
+ |
+struct AudioRecvParameters { |
+ std::string ToString() { |
+ std::ostringstream ost; |
+ ost << "{"; |
+ ost << "codecs: " << VectorToString(codecs) << ", "; |
+ ost << "extensions: " << VectorToString(extensions); |
+ ost << "}"; |
+ return ost.str(); |
+ } |
+ |
+ std::vector<AudioCodec> codecs; |
+ std::vector<RtpHeaderExtension> extensions; |
+ // TODO(pthatcher): Add "local" streams. |
+}; |
+ |
class VoiceMediaChannel : public MediaChannel { |
public: |
enum Error { |
@@ -1014,6 +1066,22 @@ class VoiceMediaChannel : public MediaChannel { |
VoiceMediaChannel() {} |
virtual ~VoiceMediaChannel() {} |
+ // TODO(pthatcher): Remove SetSendCodecs, |
+ // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions |
+ // once all implementations implement SetSendParameters. |
+ virtual bool SetSendParameters(const AudioSendParameters& params) { |
+ return (SetSendCodecs(params.codecs) && |
+ SetSendRtpHeaderExtensions(params.extensions) && |
+ SetMaxSendBandwidth(params.max_bandwidth_bps) && |
+ SetOptions(params.options)); |
+ } |
+ // TODO(pthatcher): Remove SetRecvCodecs and |
+ // SetRecvRtpHeaderExtensions once all implementations implement |
+ // SetRecvParameters. |
+ virtual bool SetRecvParameters(const AudioRecvParameters& params) { |
+ return (SetRecvCodecs(params.codecs) && |
+ SetRecvRtpHeaderExtensions(params.extensions)); |
+ } |
// Sets the codecs/payload types to be used for incoming media. |
virtual bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) = 0; |
// Sets the codecs/payload types to be used for outgoing media. |
@@ -1069,6 +1137,41 @@ class VoiceMediaChannel : public MediaChannel { |
sigslot::signal2<uint32, VoiceMediaChannel::Error> SignalMediaError; |
}; |
+struct VideoSendParameters { |
+ std::string ToString() { |
+ std::ostringstream ost; |
+ ost << "{"; |
+ ost << "codecs: " << VectorToString(codecs) << ", "; |
+ ost << "extensions: " << VectorToString(extensions) << ", "; |
+ ost << "max_bandiwidth_bps: " << max_bandwidth_bps << ", "; |
+ ost << "options: " << options.ToString(); |
+ ost << "}"; |
+ return ost.str(); |
+ } |
+ |
+ std::vector<VideoCodec> codecs; |
+ std::vector<RtpHeaderExtension> extensions; |
+ // TODO(pthatcher): Move max_bandwidth_bps into VideoOptions. |
+ int max_bandwidth_bps; |
+ VideoOptions options; |
+ // TODO(pthatcher): Add "remote" streams. |
+}; |
+ |
+struct VideoRecvParameters { |
+ std::string ToString() { |
+ std::ostringstream ost; |
+ ost << "{"; |
+ ost << "codecs: " << VectorToString(codecs) << ", "; |
+ ost << "extensions: " << VectorToString(extensions); |
+ ost << "}"; |
+ return ost.str(); |
+ } |
+ |
+ std::vector<VideoCodec> codecs; |
+ std::vector<RtpHeaderExtension> extensions; |
+ // TODO(pthatcher): Add "local" streams. |
+}; |
+ |
class VideoMediaChannel : public MediaChannel { |
public: |
enum Error { |
@@ -1090,6 +1193,22 @@ class VideoMediaChannel : public MediaChannel { |
virtual ~VideoMediaChannel() {} |
// Allow video channel to unhook itself from an associated voice channel. |
virtual void DetachVoiceChannel() = 0; |
+ // TODO(pthatcher): Remove SetSendCodecs, |
+ // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions |
+ // once all implementations implement SetSendParameters. |
+ virtual bool SetSendParameters(const VideoSendParameters& params) { |
+ return (SetSendCodecs(params.codecs) && |
+ SetSendRtpHeaderExtensions(params.extensions) && |
+ SetMaxSendBandwidth(params.max_bandwidth_bps) && |
+ SetOptions(params.options)); |
+ } |
+ // TODO(pthatcher): Remove SetRecvCodecs and |
+ // SetRecvRtpHeaderExtensions once all implementations implement |
+ // SetRecvParameters. |
+ virtual bool SetRecvParameters(const VideoRecvParameters& params) { |
+ return (SetRecvCodecs(params.codecs) && |
+ SetRecvRtpHeaderExtensions(params.extensions)); |
+ } |
// Sets the codecs/payload types to be used for incoming media. |
virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) = 0; |
// Sets the codecs/payload types to be used for outgoing media. |
@@ -1193,6 +1312,35 @@ struct SendDataParams { |
enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; |
+struct DataSendParameters { |
+ std::string ToString() { |
+ std::ostringstream ost; |
+ ost << "{"; |
+ ost << "codecs: " << VectorToString(codecs) << ", "; |
+ ost << "max_bandiwidth_bps: " << max_bandwidth_bps; |
+ ost << "}"; |
+ return ost.str(); |
+ } |
+ |
+ std::vector<DataCodec> codecs; |
+ // TODO(pthatcher): Move max_bandwidth_bps into DataOptions. |
+ int max_bandwidth_bps; |
+ // TODO(pthatcher): Add "remote" streams. |
+}; |
+ |
+struct DataRecvParameters { |
+ std::string ToString() { |
+ std::ostringstream ost; |
+ ost << "{"; |
+ ost << "codecs: " << VectorToString(codecs); |
+ ost << "}"; |
+ return ost.str(); |
+ } |
+ |
+ std::vector<DataCodec> codecs; |
+ // TODO(pthatcher): Add "local" streams. |
+}; |
+ |
class DataMediaChannel : public MediaChannel { |
public: |
enum Error { |
@@ -1207,6 +1355,19 @@ class DataMediaChannel : public MediaChannel { |
virtual ~DataMediaChannel() {} |
+ // TODO(pthatcher): Remove SetSendCodecs, |
+ // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions |
+ // once all implementations implement SetSendParameters. |
+ virtual bool SetSendParameters(const DataSendParameters& params) { |
+ return (SetSendCodecs(params.codecs) && |
+ SetMaxSendBandwidth(params.max_bandwidth_bps)); |
+ } |
+ // TODO(pthatcher): Remove SetRecvCodecs and |
+ // SetRecvRtpHeaderExtensions once all implementations implement |
+ // SetRecvParameters. |
+ virtual bool SetRecvParameters(const DataRecvParameters& params) { |
+ return SetRecvCodecs(params.codecs); |
+ } |
virtual bool SetSendCodecs(const std::vector<DataCodec>& codecs) = 0; |
virtual bool SetRecvCodecs(const std::vector<DataCodec>& codecs) = 0; |