Esempio n. 1
0
RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, blink::WebRTCPeerConnectionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exceptionState)
{
    OwnPtr<blink::WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHandler->createDTMFSender(track->component()));
    if (!handler) {
        exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrack provided is not an element of a MediaStream that's currently in the local streams set.");
        return nullptr;
    }

    RTCDTMFSender* dtmfSender = adoptRefCountedGarbageCollectedWillBeNoop(new RTCDTMFSender(context, track, handler.release()));
    dtmfSender->suspendIfNeeded();
    return dtmfSender;
}
Esempio n. 2
0
RTCDTMFSender* RTCDTMFSender::create(
    ExecutionContext* context,
    WebRTCPeerConnectionHandler* peerConnectionHandler,
    MediaStreamTrack* track,
    ExceptionState& exceptionState) {
  std::unique_ptr<WebRTCDTMFSenderHandler> handler =
      wrapUnique(peerConnectionHandler->createDTMFSender(track->component()));
  if (!handler) {
    exceptionState.throwDOMException(NotSupportedError,
                                     "The MediaStreamTrack provided is not an "
                                     "element of a MediaStream that's "
                                     "currently in the local streams set.");
    return nullptr;
  }

  RTCDTMFSender* dtmfSender =
      new RTCDTMFSender(context, track, std::move(handler));
  dtmfSender->suspendIfNeeded();
  return dtmfSender;
}