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

Side by Side Diff: Source/modules/mediastream/RTCPeerConnection.cpp

Issue 16305017: Removes the old createDataChannel and starts to use the new one with WebRTCDataChannelInit (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "modules/mediastream/RTCDataChannelEvent.h" 50 #include "modules/mediastream/RTCDataChannelEvent.h"
51 #include "modules/mediastream/RTCErrorCallback.h" 51 #include "modules/mediastream/RTCErrorCallback.h"
52 #include "modules/mediastream/RTCIceCandidate.h" 52 #include "modules/mediastream/RTCIceCandidate.h"
53 #include "modules/mediastream/RTCIceCandidateEvent.h" 53 #include "modules/mediastream/RTCIceCandidateEvent.h"
54 #include "modules/mediastream/RTCSessionDescription.h" 54 #include "modules/mediastream/RTCSessionDescription.h"
55 #include "modules/mediastream/RTCSessionDescriptionCallback.h" 55 #include "modules/mediastream/RTCSessionDescriptionCallback.h"
56 #include "modules/mediastream/RTCSessionDescriptionRequestImpl.h" 56 #include "modules/mediastream/RTCSessionDescriptionRequestImpl.h"
57 #include "modules/mediastream/RTCStatsCallback.h" 57 #include "modules/mediastream/RTCStatsCallback.h"
58 #include "modules/mediastream/RTCStatsRequestImpl.h" 58 #include "modules/mediastream/RTCStatsRequestImpl.h"
59 #include "modules/mediastream/RTCVoidRequestImpl.h" 59 #include "modules/mediastream/RTCVoidRequestImpl.h"
60 #include "public/platform/WebRTCDataChannelInit.h"
60 #include "public/platform/WebRTCICECandidate.h" 61 #include "public/platform/WebRTCICECandidate.h"
61 #include "public/platform/WebRTCSessionDescription.h" 62 #include "public/platform/WebRTCSessionDescription.h"
62 63
63 namespace WebCore { 64 namespace WebCore {
64 65
65 PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Diction ary& configuration, ExceptionCode& ec) 66 PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Diction ary& configuration, ExceptionCode& ec)
66 { 67 {
67 if (configuration.isUndefinedOrNull()) 68 if (configuration.isUndefinedOrNull())
68 return 0; 69 return 0;
69 70
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 m_peerHandler->getStats(statsRequest.release()); 438 m_peerHandler->getStats(statsRequest.release());
438 } 439 }
439 440
440 PassRefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, co nst Dictionary& options, ExceptionCode& ec) 441 PassRefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String label, co nst Dictionary& options, ExceptionCode& ec)
441 { 442 {
442 if (m_signalingState == SignalingStateClosed) { 443 if (m_signalingState == SignalingStateClosed) {
443 ec = INVALID_STATE_ERR; 444 ec = INVALID_STATE_ERR;
444 return 0; 445 return 0;
445 } 446 }
446 447
447 bool reliable = true; 448 WebKit::WebRTCDataChannelInit init;
448 options.get("reliable", reliable); 449 options.get("ordered", init.ordered);
449 RefPtr<RTCDataChannel> channel = RTCDataChannel::create(scriptExecutionConte xt(), m_peerHandler.get(), label, reliable, ec); 450 options.get("negotiated", init.negotiated);
451
452 unsigned short value = 0;
453 if (options.get("id", value))
454 init.id = value;
455 if (options.get("maxRetransmits", value))
456 init.maxRetransmits = value;
457 if (options.get("maxRetransmitTime", value))
458 init.maxRetransmitTime = value;
459
460 String protocolString;
461 options.get("protocol", protocolString);
462 init.protocol = protocolString;
463
464 RefPtr<RTCDataChannel> channel = RTCDataChannel::create(scriptExecutionConte xt(), m_peerHandler.get(), label, init, ec);
450 if (ec) 465 if (ec)
451 return 0; 466 return 0;
452 m_dataChannels.append(channel); 467 m_dataChannels.append(channel);
453 return channel.release(); 468 return channel.release();
454 } 469 }
455 470
456 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) 471 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId)
457 { 472 {
458 for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_lo calStreams.end(); ++iter) { 473 for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_lo calStreams.end(); ++iter) {
459 if ((*iter)->getTrackById(trackId)) 474 if ((*iter)->getTrackById(trackId))
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 events.swap(m_scheduledEvents); 666 events.swap(m_scheduledEvents);
652 667
653 Vector<RefPtr<Event> >::iterator it = events.begin(); 668 Vector<RefPtr<Event> >::iterator it = events.begin();
654 for (; it != events.end(); ++it) 669 for (; it != events.end(); ++it)
655 dispatchEvent((*it).release()); 670 dispatchEvent((*it).release());
656 671
657 events.clear(); 672 events.clear();
658 } 673 }
659 674
660 } // namespace WebCore 675 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698