Use AsyncInvoker in DataChannel instead of MessageHandler
Bug: webrtc:9702 Change-Id: I76a6a97f792be632c1c2f4f5cbbd26a7ec243006 Reviewed-on: https://webrtc-review.googlesource.com/97183 Reviewed-by: Seth Hampson <shampson@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24517}
This commit is contained in:
@ -24,10 +24,6 @@ namespace webrtc {
|
||||
static size_t kMaxQueuedReceivedDataBytes = 16 * 1024 * 1024;
|
||||
static size_t kMaxQueuedSendDataBytes = 16 * 1024 * 1024;
|
||||
|
||||
enum {
|
||||
MSG_CHANNELREADY,
|
||||
};
|
||||
|
||||
bool SctpSidAllocator::AllocateSid(rtc::SSLRole role, int* sid) {
|
||||
int potential_sid = (role == rtc::SSL_CLIENT) ? 0 : 1;
|
||||
while (!IsSidAvailable(potential_sid)) {
|
||||
@ -187,7 +183,8 @@ bool DataChannel::Init(const InternalDataChannelInit& config) {
|
||||
// Chrome glue and WebKit) are not wired up properly until after this
|
||||
// function returns.
|
||||
if (provider_->ReadyToSendData()) {
|
||||
rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_CHANNELREADY, NULL);
|
||||
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, rtc::Thread::Current(),
|
||||
[this] { OnChannelReady(true); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,14 +343,6 @@ void DataChannel::SetSendSsrc(uint32_t send_ssrc) {
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void DataChannel::OnMessage(rtc::Message* msg) {
|
||||
switch (msg->message_id) {
|
||||
case MSG_CHANNELREADY:
|
||||
OnChannelReady(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DataChannel::OnDataReceived(const cricket::ReceiveDataParams& params,
|
||||
const rtc::CopyOnWriteBuffer& payload) {
|
||||
if (data_channel_type_ == cricket::DCT_RTP && params.ssrc != receive_ssrc_) {
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "api/proxy.h"
|
||||
#include "media/base/mediachannel.h"
|
||||
#include "pc/channel.h"
|
||||
#include "rtc_base/messagehandler.h"
|
||||
#include "rtc_base/asyncinvoker.h"
|
||||
#include "rtc_base/scoped_ref_ptr.h"
|
||||
#include "rtc_base/third_party/sigslot/sigslot.h"
|
||||
|
||||
@ -114,9 +114,7 @@ class SctpSidAllocator {
|
||||
// 5. Bob sends outgoing stream reset. 6. Alice receives incoming reset,
|
||||
// Bob receives acknowledgement. Both receive OnClosingProcedureComplete
|
||||
// callback and transition to kClosed.
|
||||
class DataChannel : public DataChannelInterface,
|
||||
public sigslot::has_slots<>,
|
||||
public rtc::MessageHandler {
|
||||
class DataChannel : public DataChannelInterface, public sigslot::has_slots<> {
|
||||
public:
|
||||
static rtc::scoped_refptr<DataChannel> Create(
|
||||
DataChannelProviderInterface* provider,
|
||||
@ -146,9 +144,6 @@ class DataChannel : public DataChannelInterface,
|
||||
virtual uint64_t bytes_received() const { return bytes_received_; }
|
||||
virtual bool Send(const DataBuffer& buffer);
|
||||
|
||||
// rtc::MessageHandler override.
|
||||
virtual void OnMessage(rtc::Message* msg);
|
||||
|
||||
// Called when the channel's ready to use. That can happen when the
|
||||
// underlying DataMediaChannel becomes ready, or when this channel is a new
|
||||
// stream on an existing DataMediaChannel, and we've finished negotiation.
|
||||
@ -291,6 +286,7 @@ class DataChannel : public DataChannelInterface,
|
||||
PacketQueue queued_control_data_;
|
||||
PacketQueue queued_received_data_;
|
||||
PacketQueue queued_send_data_;
|
||||
rtc::AsyncInvoker invoker_;
|
||||
};
|
||||
|
||||
// Define proxy for DataChannelInterface.
|
||||
|
||||
Reference in New Issue
Block a user