Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Unified Diff: Source/modules/mediastream/RTCDataChannel.cpp

Issue 1171553002: Initial implementation of onbufferedamountlow (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove reference to file that no longer exists Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/mediastream/RTCDataChannel.h ('k') | Source/modules/mediastream/RTCDataChannel.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/mediastream/RTCDataChannel.cpp
diff --git a/Source/modules/mediastream/RTCDataChannel.cpp b/Source/modules/mediastream/RTCDataChannel.cpp
index d380bcb953df240f7430ebf2ca2712dda7399843..1e756bb8170965b3f9922f955760aded94e3e1cb 100644
--- a/Source/modules/mediastream/RTCDataChannel.cpp
+++ b/Source/modules/mediastream/RTCDataChannel.cpp
@@ -76,6 +76,7 @@ RTCDataChannel::RTCDataChannel(ExecutionContext* context, RTCPeerConnection* con
, m_binaryType(BinaryTypeArrayBuffer)
, m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired)
, m_connection(connection)
+ , m_bufferedAmountLowThreshold(0U)
{
m_handler->setClient(this);
}
@@ -156,6 +157,16 @@ unsigned RTCDataChannel::bufferedAmount() const
return m_handler->bufferedAmount();
}
+unsigned RTCDataChannel::bufferedAmountLowThreshold() const
+{
+ return m_bufferedAmountLowThreshold;
+}
+
+void RTCDataChannel::setBufferedAmountLowThreshold(unsigned threshold)
+{
+ m_bufferedAmountLowThreshold = threshold;
+}
+
String RTCDataChannel::binaryType() const
{
switch (m_binaryType) {
@@ -250,6 +261,14 @@ void RTCDataChannel::didChangeReadyState(WebRTCDataChannelHandlerClient::ReadySt
}
}
+void RTCDataChannel::didDecreaseBufferedAmount(unsigned previousAmount)
+{
+ if (previousAmount > m_bufferedAmountLowThreshold
+ && bufferedAmount() <= m_bufferedAmountLowThreshold) {
+ scheduleDispatchEvent(Event::create(EventTypeNames::bufferedamountlow));
+ }
+}
+
void RTCDataChannel::didReceiveStringData(const WebString& text)
{
if (m_stopped)
« no previous file with comments | « Source/modules/mediastream/RTCDataChannel.h ('k') | Source/modules/mediastream/RTCDataChannel.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698