Ignore empty data in DataChannel::Send to match FF's behavior.
BUG=crbug/395205
R=pthatcher@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/16949004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6742 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/datachannel.cc b/talk/app/webrtc/datachannel.cc
index af4fb24..d98f8be 100644
--- a/talk/app/webrtc/datachannel.cc
+++ b/talk/app/webrtc/datachannel.cc
@@ -195,6 +195,14 @@
if (state_ != kOpen) {
return false;
}
+
+ // TODO(jiayl): the spec is unclear about if the remote side should get the
+ // onmessage event. We need to figure out the expected behavior and change the
+ // code accordingly.
+ if (buffer.size() == 0) {
+ return true;
+ }
+
// If the queue is non-empty, we're waiting for SignalReadyToSend,
// so just add to the end of the queue and keep waiting.
if (!queued_send_data_.Empty()) {