webrtc_m130/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection+Private.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

108 lines
3.4 KiB
C
Raw Normal View History

/*
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#import "WebRTC/RTCPeerConnection.h"
#include "webrtc/api/peerconnectioninterface.h"
NS_ASSUME_NONNULL_BEGIN
namespace webrtc {
/**
* These objects are created by RTCPeerConnectionFactory to wrap an
* id<RTCPeerConnectionDelegate> and call methods on that interface.
*/
class PeerConnectionDelegateAdapter : public PeerConnectionObserver {
public:
PeerConnectionDelegateAdapter(RTCPeerConnection *peerConnection);
virtual ~PeerConnectionDelegateAdapter();
void OnSignalingChange(
PeerConnectionInterface::SignalingState new_state) override;
void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) override;
void OnRemoveStream(rtc::scoped_refptr<MediaStreamInterface> stream) override;
void OnDataChannel(
rtc::scoped_refptr<DataChannelInterface> data_channel) override;
void OnRenegotiationNeeded() override;
void OnIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) override;
void OnIceGatheringChange(
PeerConnectionInterface::IceGatheringState new_state) override;
void OnIceCandidate(const IceCandidateInterface *candidate) override;
void OnIceCandidatesRemoved(
const std::vector<cricket::Candidate>& candidates) override;
private:
Revert of Add the OnAddTrack callback for Objective-C wrapper. (patchset #7 id:240001 of https://codereview.webrtc.org/2513063003/ ) Reason for revert: This CL breaks iOS AppRTCMobile. We don't have any automatic tests running on the bots yet, so please try AppRTCMobile locally before relanding. Stack trace: * thread #15: tid = 0x20e933, 0x0000000100488440 AppRTCMobile`webrtc::AudioRtpReceiver::OnFirstPacketReceived(this=0x0000000170156c60, channel=0x000000010511a600) + 48 at rtpreceiver.cc:133, name = 'Thread 0x0x10421b2a0', stop reason = EXC_BAD_ACCESS (code=1, address=0x1a1aac71979) * frame #0: 0x0000000100488440 AppRTCMobile`webrtc::AudioRtpReceiver::OnFirstPacketReceived(this=0x0000000170156c60, channel=0x000000010511a600) + 48 at rtpreceiver.cc:133 frame #1: 0x000000010048a3f8 AppRTCMobile`void sigslot::_opaque_connection::emitter<webrtc::AudioRtpReceiver, cricket::BaseChannel*>(self=0x000000017424b380, args=0x000000010511a600) + 184 at sigslot.h:391 frame #2: 0x00000001005a30ec AppRTCMobile`void sigslot::_opaque_connection::emit<cricket::BaseChannel*>(this=0x000000017424b380, args=0x000000010511a600) const + 56 at sigslot.h:381 frame #3: 0x00000001005a3094 AppRTCMobile`sigslot::signal_with_thread_policy<sigslot::single_threaded, cricket::BaseChannel*>::emit(this=0x000000010511a678, args=0x000000010511a600) + 504 at sigslot.h:615 frame #4: 0x000000010057ef5c AppRTCMobile`sigslot::signal_with_thread_policy<sigslot::single_threaded, cricket::BaseChannel*>::operator(this=0x000000010511a678, args=0x000000010511a600)(cricket::BaseChannel*) + 32 at sigslot.h:621 frame #5: 0x000000010057ef00 AppRTCMobile`cricket::BaseChannel::OnMessage(this=0x000000010511a600, pmsg=0x000000016e676db0) + 600 at channel.cc:1494 frame #6: 0x0000000100584a58 AppRTCMobile`cricket::VoiceChannel::OnMessage(this=0x000000010511a600, pmsg=0x000000016e676db0) + 152 at channel.cc:1909 frame #7: 0x000000010017c0dc AppRTCMobile`rtc::MessageQueue::Dispatch(this=0x000000010421b2a0, pmsg=0x000000016e676db0) + 336 at messagequeue.cc:538 frame #8: 0x00000001001d8efc AppRTCMobile`rtc::Thread::ProcessMessages(this=0x000000010421b2a0, cmsLoop=-1) + 228 at thread.cc:496 frame #9: 0x00000001001d8e08 AppRTCMobile`rtc::Thread::Run(this=0x000000010421b2a0) + 28 at thread.cc:327 frame #10: 0x00000001001d8b0c AppRTCMobile`rtc::Thread::PreRun(pv=0x000000017000f030) + 300 at thread.cc:316 frame #11: 0x00000001843f1850 libsystem_pthread.dylib`_pthread_body + 240 frame #12: 0x00000001843f1760 libsystem_pthread.dylib`_pthread_start + 284 frame #13: 0x00000001843eed94 libsystem_pthread.dylib`thread_start + 4 Original issue's description: > Add the OnAddTrack callback for Objective-C wrapper. > > Created an Obj-C wrapper for the callback OnAddTrack in this CL since it has been added to native C++ API > The callback function is called when a track is signaled by remote side and a new RtpReceiver is created. > The application can tell when tracks are added to the streams by listening to this callback. > > BUG=webrtc:6112 > > Review-Url: https://codereview.webrtc.org/2513063003 > Cr-Commit-Position: refs/heads/master@{#16835} > Committed: https://chromium.googlesource.com/external/webrtc/+/633f6fe0046131ed815098298b9a3120bac1d7a0 TBR=tkchin@webrtc.org,deadbeef@webrtc.org,zhihuang@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6112 Review-Url: https://codereview.webrtc.org/2720753002 Cr-Commit-Position: refs/heads/master@{#16871}
2017-02-27 07:04:25 -08:00
__weak RTCPeerConnection *peer_connection_;
};
} // namespace webrtc
@interface RTCPeerConnection ()
/** The native PeerConnectionInterface created during construction. */
@property(nonatomic, readonly)
rtc::scoped_refptr<webrtc::PeerConnectionInterface> nativePeerConnection;
/** Initialize an RTCPeerConnection with a configuration, constraints, and
* delegate.
*/
- (instancetype)initWithFactory:
(RTCPeerConnectionFactory *)factory
configuration:
(RTCConfiguration *)configuration
constraints:
(RTCMediaConstraints *)constraints
delegate:
(nullable id<RTCPeerConnectionDelegate>)delegate
NS_DESIGNATED_INITIALIZER;
+ (webrtc::PeerConnectionInterface::SignalingState)nativeSignalingStateForState:
(RTCSignalingState)state;
+ (RTCSignalingState)signalingStateForNativeState:
(webrtc::PeerConnectionInterface::SignalingState)nativeState;
+ (NSString *)stringForSignalingState:(RTCSignalingState)state;
+ (webrtc::PeerConnectionInterface::IceConnectionState)
nativeIceConnectionStateForState:(RTCIceConnectionState)state;
+ (RTCIceConnectionState)iceConnectionStateForNativeState:
(webrtc::PeerConnectionInterface::IceConnectionState)nativeState;
+ (NSString *)stringForIceConnectionState:(RTCIceConnectionState)state;
+ (webrtc::PeerConnectionInterface::IceGatheringState)
nativeIceGatheringStateForState:(RTCIceGatheringState)state;
+ (RTCIceGatheringState)iceGatheringStateForNativeState:
(webrtc::PeerConnectionInterface::IceGatheringState)nativeState;
+ (NSString *)stringForIceGatheringState:(RTCIceGatheringState)state;
+ (webrtc::PeerConnectionInterface::StatsOutputLevel)
nativeStatsOutputLevelForLevel:(RTCStatsOutputLevel)level;
@end
NS_ASSUME_NONNULL_END