| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "bindings/v8/ExceptionState.h" | 29 #include "bindings/v8/ExceptionState.h" |
| 30 #include "core/dom/ExceptionCode.h" | 30 #include "core/dom/ExceptionCode.h" |
| 31 #include "core/dom/ScriptExecutionContext.h" | 31 #include "core/dom/ScriptExecutionContext.h" |
| 32 #include "core/platform/mediastream/RTCDTMFSenderHandler.h" | 32 #include "core/platform/mediastream/RTCDTMFSenderHandler.h" |
| 33 #include "core/platform/mediastream/RTCPeerConnectionHandler.h" | 33 #include "core/platform/mediastream/RTCPeerConnectionHandler.h" |
| 34 #include "modules/mediastream/MediaStreamTrack.h" | 34 #include "modules/mediastream/MediaStreamTrack.h" |
| 35 #include "modules/mediastream/RTCDTMFToneChangeEvent.h" | 35 #include "modules/mediastream/RTCDTMFToneChangeEvent.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 static const long minToneDurationMs = 70; | 39 static const int minToneDurationMs = 70; |
| 40 static const long defaultToneDurationMs = 100; | 40 static const int defaultToneDurationMs = 100; |
| 41 static const long maxToneDurationMs = 6000; | 41 static const int maxToneDurationMs = 6000; |
| 42 static const long minInterToneGapMs = 50; | 42 static const int minInterToneGapMs = 50; |
| 43 static const long defaultInterToneGapMs = 50; | 43 static const int defaultInterToneGapMs = 50; |
| 44 | 44 |
| 45 PassRefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context,
RTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrack> p
rpTrack, ExceptionState& es) | 45 PassRefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context,
RTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrack> p
rpTrack, ExceptionState& es) |
| 46 { | 46 { |
| 47 RefPtr<MediaStreamTrack> track = prpTrack; | 47 RefPtr<MediaStreamTrack> track = prpTrack; |
| 48 OwnPtr<RTCDTMFSenderHandler> handler = peerConnectionHandler->createDTMFSend
er(track->component()); | 48 OwnPtr<RTCDTMFSenderHandler> handler = peerConnectionHandler->createDTMFSend
er(track->component()); |
| 49 if (!handler) { | 49 if (!handler) { |
| 50 es.throwDOMException(NotSupportedError); | 50 es.throwDOMException(NotSupportedError); |
| 51 return 0; | 51 return 0; |
| 52 } | 52 } |
| 53 | 53 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 String RTCDTMFSender::toneBuffer() const | 86 String RTCDTMFSender::toneBuffer() const |
| 87 { | 87 { |
| 88 return m_handler->currentToneBuffer(); | 88 return m_handler->currentToneBuffer(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void RTCDTMFSender::insertDTMF(const String& tones, ExceptionState& es) | 91 void RTCDTMFSender::insertDTMF(const String& tones, ExceptionState& es) |
| 92 { | 92 { |
| 93 insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, es); | 93 insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, es); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void RTCDTMFSender::insertDTMF(const String& tones, long duration, ExceptionStat
e& es) | 96 void RTCDTMFSender::insertDTMF(const String& tones, int duration, ExceptionState
& es) |
| 97 { | 97 { |
| 98 insertDTMF(tones, duration, defaultInterToneGapMs, es); | 98 insertDTMF(tones, duration, defaultInterToneGapMs, es); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interTon
eGap, ExceptionState& es) | 101 void RTCDTMFSender::insertDTMF(const String& tones, int duration, int interToneG
ap, ExceptionState& es) |
| 102 { | 102 { |
| 103 if (!canInsertDTMF()) { | 103 if (!canInsertDTMF()) { |
| 104 es.throwDOMException(NotSupportedError); | 104 es.throwDOMException(NotSupportedError); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 | 107 |
| 108 if (duration > maxToneDurationMs || duration < minToneDurationMs) { | 108 if (duration > maxToneDurationMs || duration < minToneDurationMs) { |
| 109 es.throwDOMException(SyntaxError); | 109 es.throwDOMException(SyntaxError); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 Vector<RefPtr<Event> > events; | 169 Vector<RefPtr<Event> > events; |
| 170 events.swap(m_scheduledEvents); | 170 events.swap(m_scheduledEvents); |
| 171 | 171 |
| 172 Vector<RefPtr<Event> >::iterator it = events.begin(); | 172 Vector<RefPtr<Event> >::iterator it = events.begin(); |
| 173 for (; it != events.end(); ++it) | 173 for (; it != events.end(); ++it) |
| 174 dispatchEvent((*it).release()); | 174 dispatchEvent((*it).release()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace WebCore | 177 } // namespace WebCore |
| OLD | NEW |