pRevert 5371 "Revert 5367 "Update talk to 59410372.""

> Revert 5367 "Update talk to 59410372."
> 
> > Update talk to 59410372.
> > 
> > R=jiayl@webrtc.org, wu@webrtc.org
> > 
> > Review URL: https://webrtc-codereview.appspot.com/6929004
> 
> TBR=mallinath@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/6999004

TBR=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/7109004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5381 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrika@webrtc.org
2014-01-14 10:00:58 +00:00
parent 4371d4650a
commit aebb1ade9d
50 changed files with 974 additions and 746 deletions

View File

@ -64,6 +64,25 @@ class DataChannelProviderInterface {
virtual ~DataChannelProviderInterface() {}
};
struct InternalDataChannelInit : public DataChannelInit {
enum OpenHandshakeRole {
kOpener,
kAcker,
kNone
};
// The default role is kOpener because the default |negotiated| is false.
InternalDataChannelInit() : open_handshake_role(kOpener) {}
explicit InternalDataChannelInit(const DataChannelInit& base)
: DataChannelInit(base), open_handshake_role(kOpener) {
// If the channel is externally negotiated, do not send the OPEN message.
if (base.negotiated) {
open_handshake_role = kNone;
}
}
OpenHandshakeRole open_handshake_role;
};
// DataChannel is a an implementation of the DataChannelInterface based on
// libjingle's data engine. It provides an implementation of unreliable or
// reliabledata channels. Currently this class is specifically designed to use
@ -87,7 +106,7 @@ class DataChannel : public DataChannelInterface,
DataChannelProviderInterface* provider,
cricket::DataChannelType dct,
const std::string& label,
const DataChannelInit* config);
const InternalDataChannelInit& config);
virtual void RegisterObserver(DataChannelObserver* observer);
virtual void UnregisterObserver();
@ -156,7 +175,7 @@ class DataChannel : public DataChannelInterface,
virtual ~DataChannel();
private:
bool Init(const DataChannelInit* config);
bool Init(const InternalDataChannelInit& config);
void DoClose();
void UpdateState();
void SetState(DataState state);
@ -172,19 +191,20 @@ class DataChannel : public DataChannelInterface,
cricket::SendDataResult* send_result);
bool QueueSendData(const DataBuffer& buffer);
bool SendOpenMessage(const talk_base::Buffer* buffer);
bool SendOpenAckMessage(const talk_base::Buffer* buffer);
std::string label_;
DataChannelInit config_;
InternalDataChannelInit config_;
DataChannelObserver* observer_;
DataState state_;
bool was_ever_writable_;
bool connected_to_provider_;
cricket::DataChannelType data_channel_type_;
DataChannelProviderInterface* provider_;
bool waiting_for_open_ack_;
bool was_ever_writable_;
bool connected_to_provider_;
bool send_ssrc_set_;
uint32 send_ssrc_;
bool receive_ssrc_set_;
uint32 send_ssrc_;
uint32 receive_ssrc_;
// Control messages that always have to get sent out before any queued
// data.
@ -197,7 +217,7 @@ class DataChannelFactory {
public:
virtual talk_base::scoped_refptr<DataChannel> CreateDataChannel(
const std::string& label,
const DataChannelInit* config) = 0;
const InternalDataChannelInit* config) = 0;
protected:
virtual ~DataChannelFactory() {}