Update talk to 56092586.
R=jiayl@webrtc.org, mallinath@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/3359004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5078 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/datachannel.cc b/talk/app/webrtc/datachannel.cc
index 3a6046e..6f30487 100644
--- a/talk/app/webrtc/datachannel.cc
+++ b/talk/app/webrtc/datachannel.cc
@@ -38,6 +38,10 @@
static size_t kMaxQueuedReceivedDataPackets = 100;
static size_t kMaxQueuedSendDataPackets = 100;
+enum {
+ MSG_CHANNELREADY,
+};
+
talk_base::scoped_refptr<DataChannel> DataChannel::Create(
DataChannelProviderInterface* provider,
cricket::DataChannelType dct,
@@ -95,6 +99,15 @@
// Try to connect to the transport in case the transport channel already
// exists.
OnTransportChannelCreated();
+
+ // Checks if the transport is ready to send because the initial channel
+ // ready signal may have been sent before the DataChannel creation.
+ // This has to be done async because the upper layer objects (e.g.
+ // Chrome glue and WebKit) are not wired up properly until after this
+ // function returns.
+ if (provider_->ReadyToSendData()) {
+ talk_base::Thread::Current()->Post(this, MSG_CHANNELREADY, NULL);
+ }
}
return true;
@@ -217,6 +230,14 @@
UpdateState();
}
+void DataChannel::OnMessage(talk_base::Message* msg) {
+ switch (msg->message_id) {
+ case MSG_CHANNELREADY:
+ OnChannelReady(true);
+ break;
+ }
+}
+
// The underlaying data engine is closing.
// This function makes sure the DataChannel is disconnected and changes state to
// kClosed.