Prepare for removal of PeerConnectionObserver::OnError.
Prepare for removal of constraints to PeerConnection::AddStream. OnError has never been implemented and has been removed from the spec. Also, constraints to PeerConnection::AddStream has also been removed from the spec and have never been implemented. R=pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/23319004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7605 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -586,13 +586,6 @@ class PCOJava : public PeerConnectionObserver {
|
|||||||
CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
|
CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnError() OVERRIDE {
|
|
||||||
ScopedLocalRefFrame local_ref_frame(jni());
|
|
||||||
jmethodID m = GetMethodID(jni(), *j_observer_class_, "onError", "()V");
|
|
||||||
jni()->CallVoidMethod(*j_observer_global_, m);
|
|
||||||
CHECK_EXCEPTION(jni()) << "error during CallVoidMethod";
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnSignalingChange(
|
virtual void OnSignalingChange(
|
||||||
PeerConnectionInterface::SignalingState new_state) OVERRIDE {
|
PeerConnectionInterface::SignalingState new_state) OVERRIDE {
|
||||||
ScopedLocalRefFrame local_ref_frame(jni());
|
ScopedLocalRefFrame local_ref_frame(jni());
|
||||||
@@ -3144,12 +3137,9 @@ JOW(jboolean, PeerConnection_nativeAddIceCandidate)(
|
|||||||
}
|
}
|
||||||
|
|
||||||
JOW(jboolean, PeerConnection_nativeAddLocalStream)(
|
JOW(jboolean, PeerConnection_nativeAddLocalStream)(
|
||||||
JNIEnv* jni, jobject j_pc, jlong native_stream, jobject j_constraints) {
|
JNIEnv* jni, jobject j_pc, jlong native_stream) {
|
||||||
scoped_ptr<ConstraintsWrapper> constraints(
|
|
||||||
new ConstraintsWrapper(jni, j_constraints));
|
|
||||||
return ExtractNativePC(jni, j_pc)->AddStream(
|
return ExtractNativePC(jni, j_pc)->AddStream(
|
||||||
reinterpret_cast<MediaStreamInterface*>(native_stream),
|
reinterpret_cast<MediaStreamInterface*>(native_stream));
|
||||||
constraints.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JOW(void, PeerConnection_nativeRemoveLocalStream)(
|
JOW(void, PeerConnection_nativeRemoveLocalStream)(
|
||||||
|
@@ -71,9 +71,6 @@ public class PeerConnection {
|
|||||||
/** Triggered when a new ICE candidate has been found. */
|
/** Triggered when a new ICE candidate has been found. */
|
||||||
public void onIceCandidate(IceCandidate candidate);
|
public void onIceCandidate(IceCandidate candidate);
|
||||||
|
|
||||||
/** Triggered on any error. */
|
|
||||||
public void onError();
|
|
||||||
|
|
||||||
/** Triggered when media is received on a new stream from remote peer. */
|
/** Triggered when media is received on a new stream from remote peer. */
|
||||||
public void onAddStream(MediaStream stream);
|
public void onAddStream(MediaStream stream);
|
||||||
|
|
||||||
@@ -147,9 +144,8 @@ public class PeerConnection {
|
|||||||
candidate.sdpMid, candidate.sdpMLineIndex, candidate.sdp);
|
candidate.sdpMid, candidate.sdpMLineIndex, candidate.sdp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addStream(
|
public boolean addStream(MediaStream stream) {
|
||||||
MediaStream stream, MediaConstraints constraints) {
|
boolean ret = nativeAddLocalStream(stream.nativeStream);
|
||||||
boolean ret = nativeAddLocalStream(stream.nativeStream, constraints);
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -194,8 +190,7 @@ public class PeerConnection {
|
|||||||
private native boolean nativeAddIceCandidate(
|
private native boolean nativeAddIceCandidate(
|
||||||
String sdpMid, int sdpMLineIndex, String iceCandidateSdp);
|
String sdpMid, int sdpMLineIndex, String iceCandidateSdp);
|
||||||
|
|
||||||
private native boolean nativeAddLocalStream(
|
private native boolean nativeAddLocalStream(long nativeStream);
|
||||||
long nativeStream, MediaConstraints constraints);
|
|
||||||
|
|
||||||
private native void nativeRemoveLocalStream(long nativeStream);
|
private native void nativeRemoveLocalStream(long nativeStream);
|
||||||
|
|
||||||
|
@@ -117,11 +117,6 @@ public class PeerConnectionTest extends TestCase {
|
|||||||
++expectedErrors;
|
++expectedErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void onError() {
|
|
||||||
assertTrue(--expectedErrors >= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void expectSetSize() {
|
public synchronized void expectSetSize() {
|
||||||
if (RENDER_TO_GUI) {
|
if (RENDER_TO_GUI) {
|
||||||
// When new frames are delivered to the GUI renderer we don't get
|
// When new frames are delivered to the GUI renderer we don't get
|
||||||
@@ -489,7 +484,7 @@ public class PeerConnectionTest extends TestCase {
|
|||||||
lMS.addTrack(videoTrack);
|
lMS.addTrack(videoTrack);
|
||||||
lMS.addTrack(factory.createAudioTrack(
|
lMS.addTrack(factory.createAudioTrack(
|
||||||
audioTrackId, factory.createAudioSource(new MediaConstraints())));
|
audioTrackId, factory.createAudioSource(new MediaConstraints())));
|
||||||
pc.addStream(lMS, new MediaConstraints());
|
pc.addStream(lMS);
|
||||||
return new WeakReference<MediaStream>(lMS);
|
return new WeakReference<MediaStream>(lMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -151,10 +151,8 @@ class RTCStatsObserver : public StatsObserver {
|
|||||||
return self.peerConnection->AddIceCandidate(iceCandidate.get());
|
return self.peerConnection->AddIceCandidate(iceCandidate.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)addStream:(RTCMediaStream*)stream
|
- (BOOL)addStream:(RTCMediaStream*)stream {
|
||||||
constraints:(RTCMediaConstraints*)constraints {
|
BOOL ret = self.peerConnection->AddStream(stream.mediaStream);
|
||||||
BOOL ret = self.peerConnection->AddStream(stream.mediaStream,
|
|
||||||
constraints.constraints);
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@@ -41,8 +41,6 @@ class RTCPeerConnectionObserver : public PeerConnectionObserver {
|
|||||||
RTCPeerConnectionObserver(RTCPeerConnection* peerConnection);
|
RTCPeerConnectionObserver(RTCPeerConnection* peerConnection);
|
||||||
virtual ~RTCPeerConnectionObserver();
|
virtual ~RTCPeerConnectionObserver();
|
||||||
|
|
||||||
virtual void OnError() OVERRIDE;
|
|
||||||
|
|
||||||
// Triggered when the SignalingState changed.
|
// Triggered when the SignalingState changed.
|
||||||
virtual void OnSignalingChange(
|
virtual void OnSignalingChange(
|
||||||
PeerConnectionInterface::SignalingState new_state) OVERRIDE;
|
PeerConnectionInterface::SignalingState new_state) OVERRIDE;
|
||||||
|
@@ -46,10 +46,6 @@ RTCPeerConnectionObserver::RTCPeerConnectionObserver(
|
|||||||
RTCPeerConnectionObserver::~RTCPeerConnectionObserver() {
|
RTCPeerConnectionObserver::~RTCPeerConnectionObserver() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPeerConnectionObserver::OnError() {
|
|
||||||
[_peerConnection.delegate peerConnectionOnError:_peerConnection];
|
|
||||||
}
|
|
||||||
|
|
||||||
void RTCPeerConnectionObserver::OnSignalingChange(
|
void RTCPeerConnectionObserver::OnSignalingChange(
|
||||||
PeerConnectionInterface::SignalingState new_state) {
|
PeerConnectionInterface::SignalingState new_state) {
|
||||||
RTCSignalingState state =
|
RTCSignalingState state =
|
||||||
|
@@ -64,8 +64,7 @@
|
|||||||
// Add a new MediaStream to be sent on this PeerConnection.
|
// Add a new MediaStream to be sent on this PeerConnection.
|
||||||
// Note that a SessionDescription negotiation is needed before the
|
// Note that a SessionDescription negotiation is needed before the
|
||||||
// remote peer can receive the stream.
|
// remote peer can receive the stream.
|
||||||
- (BOOL)addStream:(RTCMediaStream *)stream
|
- (BOOL)addStream:(RTCMediaStream *)stream;
|
||||||
constraints:(RTCMediaConstraints *)constraints;
|
|
||||||
|
|
||||||
// Remove a MediaStream from this PeerConnection.
|
// Remove a MediaStream from this PeerConnection.
|
||||||
// Note that a SessionDescription negotiation is need before the
|
// Note that a SessionDescription negotiation is need before the
|
||||||
|
@@ -38,9 +38,6 @@
|
|||||||
// implemented to get messages from PeerConnection.
|
// implemented to get messages from PeerConnection.
|
||||||
@protocol RTCPeerConnectionDelegate<NSObject>
|
@protocol RTCPeerConnectionDelegate<NSObject>
|
||||||
|
|
||||||
// Triggered when there is an error.
|
|
||||||
- (void)peerConnectionOnError:(RTCPeerConnection *)peerConnection;
|
|
||||||
|
|
||||||
// Triggered when the SignalingState changed.
|
// Triggered when the SignalingState changed.
|
||||||
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
- (void)peerConnection:(RTCPeerConnection *)peerConnection
|
||||||
signalingStateChanged:(RTCSignalingState)stateChanged;
|
signalingStateChanged:(RTCSignalingState)stateChanged;
|
||||||
|
@@ -151,11 +151,6 @@
|
|||||||
|
|
||||||
#pragma mark - RTCPeerConnectionDelegate methods
|
#pragma mark - RTCPeerConnectionDelegate methods
|
||||||
|
|
||||||
- (void)peerConnectionOnError:(RTCPeerConnection*)peerConnection {
|
|
||||||
NSLog(@"RTCPeerConnectionDelegate::onError");
|
|
||||||
NSAssert(--_expectedErrors >= 0, @"Unexpected error");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)peerConnection:(RTCPeerConnection*)peerConnection
|
- (void)peerConnection:(RTCPeerConnection*)peerConnection
|
||||||
signalingStateChanged:(RTCSignalingState)stateChanged {
|
signalingStateChanged:(RTCSignalingState)stateChanged {
|
||||||
int expectedState = [self popFirstElementAsInt:_expectedSignalingChanges];
|
int expectedState = [self popFirstElementAsInt:_expectedSignalingChanges];
|
||||||
|
@@ -89,8 +89,7 @@
|
|||||||
[localMediaStream addVideoTrack:videoTrack];
|
[localMediaStream addVideoTrack:videoTrack];
|
||||||
RTCAudioTrack* audioTrack = [factory audioTrackWithID:audioTrackID];
|
RTCAudioTrack* audioTrack = [factory audioTrackWithID:audioTrackID];
|
||||||
[localMediaStream addAudioTrack:audioTrack];
|
[localMediaStream addAudioTrack:audioTrack];
|
||||||
RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] init];
|
[pc addStream:localMediaStream];
|
||||||
[pc addStream:localMediaStream constraints:constraints];
|
|
||||||
return localMediaStream;
|
return localMediaStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -404,8 +404,7 @@ PeerConnection::remote_streams() {
|
|||||||
return mediastream_signaling_->remote_streams();
|
return mediastream_signaling_->remote_streams();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PeerConnection::AddStream(MediaStreamInterface* local_stream,
|
bool PeerConnection::AddStream(MediaStreamInterface* local_stream) {
|
||||||
const MediaConstraintsInterface* constraints) {
|
|
||||||
if (IsClosed()) {
|
if (IsClosed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -413,7 +412,6 @@ bool PeerConnection::AddStream(MediaStreamInterface* local_stream,
|
|||||||
local_stream))
|
local_stream))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO(perkj): Implement support for MediaConstraints in AddStream.
|
|
||||||
if (!mediastream_signaling_->AddLocalStream(local_stream)) {
|
if (!mediastream_signaling_->AddLocalStream(local_stream)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -65,8 +65,7 @@ class PeerConnection : public PeerConnectionInterface,
|
|||||||
PeerConnectionObserver* observer);
|
PeerConnectionObserver* observer);
|
||||||
virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams();
|
virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams();
|
||||||
virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams();
|
virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams();
|
||||||
virtual bool AddStream(MediaStreamInterface* local_stream,
|
virtual bool AddStream(MediaStreamInterface* local_stream);
|
||||||
const MediaConstraintsInterface* constraints);
|
|
||||||
virtual void RemoveStream(MediaStreamInterface* local_stream);
|
virtual void RemoveStream(MediaStreamInterface* local_stream);
|
||||||
|
|
||||||
virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
|
virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
|
||||||
|
@@ -179,7 +179,7 @@ class PeerConnectionTestClientBase
|
|||||||
stream->AddTrack(CreateLocalVideoTrack(stream_label));
|
stream->AddTrack(CreateLocalVideoTrack(stream_label));
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_TRUE(peer_connection_->AddStream(stream, NULL));
|
EXPECT_TRUE(peer_connection_->AddStream(stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NumberOfLocalMediaStreams() {
|
size_t NumberOfLocalMediaStreams() {
|
||||||
@@ -426,7 +426,6 @@ class PeerConnectionTestClientBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PeerConnectionObserver callbacks.
|
// PeerConnectionObserver callbacks.
|
||||||
virtual void OnError() {}
|
|
||||||
virtual void OnMessage(const std::string&) {}
|
virtual void OnMessage(const std::string&) {}
|
||||||
virtual void OnSignalingMessage(const std::string& /*msg*/) {}
|
virtual void OnSignalingMessage(const std::string& /*msg*/) {}
|
||||||
virtual void OnSignalingChange(
|
virtual void OnSignalingChange(
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "webrtc/base/thread.h"
|
#include "webrtc/base/thread.h"
|
||||||
|
|
||||||
using webrtc::FakeVideoTrackRenderer;
|
using webrtc::FakeVideoTrackRenderer;
|
||||||
|
using webrtc::DataChannelInterface;
|
||||||
using webrtc::MediaStreamInterface;
|
using webrtc::MediaStreamInterface;
|
||||||
using webrtc::PeerConnectionFactoryInterface;
|
using webrtc::PeerConnectionFactoryInterface;
|
||||||
using webrtc::PeerConnectionInterface;
|
using webrtc::PeerConnectionInterface;
|
||||||
@@ -83,13 +84,13 @@ static const char kTurnIceServerWithIPv6Address[] =
|
|||||||
|
|
||||||
class NullPeerConnectionObserver : public PeerConnectionObserver {
|
class NullPeerConnectionObserver : public PeerConnectionObserver {
|
||||||
public:
|
public:
|
||||||
virtual void OnError() {}
|
|
||||||
virtual void OnMessage(const std::string& msg) {}
|
virtual void OnMessage(const std::string& msg) {}
|
||||||
virtual void OnSignalingMessage(const std::string& msg) {}
|
virtual void OnSignalingMessage(const std::string& msg) {}
|
||||||
virtual void OnSignalingChange(
|
virtual void OnSignalingChange(
|
||||||
PeerConnectionInterface::SignalingState new_state) {}
|
PeerConnectionInterface::SignalingState new_state) {}
|
||||||
virtual void OnAddStream(MediaStreamInterface* stream) {}
|
virtual void OnAddStream(MediaStreamInterface* stream) {}
|
||||||
virtual void OnRemoveStream(MediaStreamInterface* stream) {}
|
virtual void OnRemoveStream(MediaStreamInterface* stream) {}
|
||||||
|
virtual void OnDataChannel(DataChannelInterface* data_channel) {}
|
||||||
virtual void OnRenegotiationNeeded() {}
|
virtual void OnRenegotiationNeeded() {}
|
||||||
virtual void OnIceConnectionChange(
|
virtual void OnIceConnectionChange(
|
||||||
PeerConnectionInterface::IceConnectionState new_state) {}
|
PeerConnectionInterface::IceConnectionState new_state) {}
|
||||||
|
@@ -252,11 +252,17 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
|||||||
virtual rtc::scoped_refptr<StreamCollectionInterface>
|
virtual rtc::scoped_refptr<StreamCollectionInterface>
|
||||||
remote_streams() = 0;
|
remote_streams() = 0;
|
||||||
|
|
||||||
|
// Deprecated:
|
||||||
|
// TODO(perkj): Remove once its not used by Chrome.
|
||||||
|
virtual bool AddStream(MediaStreamInterface* stream,
|
||||||
|
const MediaConstraintsInterface* constraints) {
|
||||||
|
return AddStream(stream);
|
||||||
|
}
|
||||||
|
|
||||||
// Add a new MediaStream to be sent on this PeerConnection.
|
// Add a new MediaStream to be sent on this PeerConnection.
|
||||||
// Note that a SessionDescription negotiation is needed before the
|
// Note that a SessionDescription negotiation is needed before the
|
||||||
// remote peer can receive the stream.
|
// remote peer can receive the stream.
|
||||||
virtual bool AddStream(MediaStreamInterface* stream,
|
virtual bool AddStream(MediaStreamInterface* stream) = 0;
|
||||||
const MediaConstraintsInterface* constraints) = 0;
|
|
||||||
|
|
||||||
// Remove a MediaStream from this PeerConnection.
|
// Remove a MediaStream from this PeerConnection.
|
||||||
// Note that a SessionDescription negotiation is need before the
|
// Note that a SessionDescription negotiation is need before the
|
||||||
@@ -344,7 +350,9 @@ class PeerConnectionObserver {
|
|||||||
kIceState,
|
kIceState,
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void OnError() = 0;
|
// Deprecated.
|
||||||
|
// TODO(perkj): Remove once its not used by Chrome.
|
||||||
|
virtual void OnError() {}
|
||||||
|
|
||||||
// Triggered when the SignalingState changed.
|
// Triggered when the SignalingState changed.
|
||||||
virtual void OnSignalingChange(
|
virtual void OnSignalingChange(
|
||||||
@@ -361,8 +369,7 @@ class PeerConnectionObserver {
|
|||||||
virtual void OnRemoveStream(MediaStreamInterface* stream) = 0;
|
virtual void OnRemoveStream(MediaStreamInterface* stream) = 0;
|
||||||
|
|
||||||
// Triggered when a remote peer open a data channel.
|
// Triggered when a remote peer open a data channel.
|
||||||
// TODO(perkj): Make pure virtual.
|
virtual void OnDataChannel(DataChannelInterface* data_channel) = 0;
|
||||||
virtual void OnDataChannel(DataChannelInterface* data_channel) {}
|
|
||||||
|
|
||||||
// Triggered when renegotiation is needed, for example the ICE has restarted.
|
// Triggered when renegotiation is needed, for example the ICE has restarted.
|
||||||
virtual void OnRenegotiationNeeded() = 0;
|
virtual void OnRenegotiationNeeded() = 0;
|
||||||
|
@@ -132,7 +132,6 @@ class MockPeerConnectionObserver : public PeerConnectionObserver {
|
|||||||
state_ = pc_->signaling_state();
|
state_ = pc_->signaling_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void OnError() {}
|
|
||||||
virtual void OnSignalingChange(
|
virtual void OnSignalingChange(
|
||||||
PeerConnectionInterface::SignalingState new_state) {
|
PeerConnectionInterface::SignalingState new_state) {
|
||||||
EXPECT_EQ(pc_->signaling_state(), new_state);
|
EXPECT_EQ(pc_->signaling_state(), new_state);
|
||||||
@@ -320,7 +319,7 @@ class PeerConnectionInterfaceTest : public testing::Test {
|
|||||||
scoped_refptr<VideoTrackInterface> video_track(
|
scoped_refptr<VideoTrackInterface> video_track(
|
||||||
pc_factory_->CreateVideoTrack(label + "v0", video_source));
|
pc_factory_->CreateVideoTrack(label + "v0", video_source));
|
||||||
stream->AddTrack(video_track.get());
|
stream->AddTrack(video_track.get());
|
||||||
EXPECT_TRUE(pc_->AddStream(stream, NULL));
|
EXPECT_TRUE(pc_->AddStream(stream));
|
||||||
EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
|
EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
|
||||||
observer_.renegotiation_needed_ = false;
|
observer_.renegotiation_needed_ = false;
|
||||||
}
|
}
|
||||||
@@ -332,7 +331,7 @@ class PeerConnectionInterfaceTest : public testing::Test {
|
|||||||
scoped_refptr<AudioTrackInterface> audio_track(
|
scoped_refptr<AudioTrackInterface> audio_track(
|
||||||
pc_factory_->CreateAudioTrack(label + "a0", NULL));
|
pc_factory_->CreateAudioTrack(label + "a0", NULL));
|
||||||
stream->AddTrack(audio_track.get());
|
stream->AddTrack(audio_track.get());
|
||||||
EXPECT_TRUE(pc_->AddStream(stream, NULL));
|
EXPECT_TRUE(pc_->AddStream(stream));
|
||||||
EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
|
EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
|
||||||
observer_.renegotiation_needed_ = false;
|
observer_.renegotiation_needed_ = false;
|
||||||
}
|
}
|
||||||
@@ -350,7 +349,7 @@ class PeerConnectionInterfaceTest : public testing::Test {
|
|||||||
scoped_refptr<VideoTrackInterface> video_track(
|
scoped_refptr<VideoTrackInterface> video_track(
|
||||||
pc_factory_->CreateVideoTrack(video_track_label, NULL));
|
pc_factory_->CreateVideoTrack(video_track_label, NULL));
|
||||||
stream->AddTrack(video_track.get());
|
stream->AddTrack(video_track.get());
|
||||||
EXPECT_TRUE(pc_->AddStream(stream, NULL));
|
EXPECT_TRUE(pc_->AddStream(stream));
|
||||||
EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
|
EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
|
||||||
observer_.renegotiation_needed_ = false;
|
observer_.renegotiation_needed_ = false;
|
||||||
}
|
}
|
||||||
@@ -574,7 +573,7 @@ TEST_F(PeerConnectionInterfaceTest, AddStreams) {
|
|||||||
pc_factory_->CreateAudioTrack(
|
pc_factory_->CreateAudioTrack(
|
||||||
kStreamLabel3, static_cast<AudioSourceInterface*>(NULL)));
|
kStreamLabel3, static_cast<AudioSourceInterface*>(NULL)));
|
||||||
stream->AddTrack(audio_track.get());
|
stream->AddTrack(audio_track.get());
|
||||||
EXPECT_TRUE(pc_->AddStream(stream, NULL));
|
EXPECT_TRUE(pc_->AddStream(stream));
|
||||||
EXPECT_EQ(3u, pc_->local_streams()->count());
|
EXPECT_EQ(3u, pc_->local_streams()->count());
|
||||||
|
|
||||||
// Remove the third stream.
|
// Remove the third stream.
|
||||||
@@ -1180,7 +1179,7 @@ TEST_F(PeerConnectionInterfaceTest, CloseAndTestMethods) {
|
|||||||
pc_->Close();
|
pc_->Close();
|
||||||
|
|
||||||
pc_->RemoveStream(local_stream);
|
pc_->RemoveStream(local_stream);
|
||||||
EXPECT_FALSE(pc_->AddStream(local_stream, NULL));
|
EXPECT_FALSE(pc_->AddStream(local_stream));
|
||||||
|
|
||||||
ASSERT_FALSE(local_stream->GetAudioTracks().empty());
|
ASSERT_FALSE(local_stream->GetAudioTracks().empty());
|
||||||
rtc::scoped_refptr<webrtc::DtmfSenderInterface> dtmf_sender(
|
rtc::scoped_refptr<webrtc::DtmfSenderInterface> dtmf_sender(
|
||||||
|
@@ -39,8 +39,7 @@ BEGIN_PROXY_MAP(PeerConnection)
|
|||||||
local_streams)
|
local_streams)
|
||||||
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>,
|
PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>,
|
||||||
remote_streams)
|
remote_streams)
|
||||||
PROXY_METHOD2(bool, AddStream, MediaStreamInterface*,
|
PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
|
||||||
const MediaConstraintsInterface*)
|
|
||||||
PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
|
PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
|
||||||
PROXY_METHOD1(rtc::scoped_refptr<DtmfSenderInterface>,
|
PROXY_METHOD1(rtc::scoped_refptr<DtmfSenderInterface>,
|
||||||
CreateDtmfSender, AudioTrackInterface*)
|
CreateDtmfSender, AudioTrackInterface*)
|
||||||
|
@@ -253,7 +253,7 @@ void PeerConnectionTestWrapper::GetAndAddUserMedia(
|
|||||||
bool video, const webrtc::FakeConstraints& video_constraints) {
|
bool video, const webrtc::FakeConstraints& video_constraints) {
|
||||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
|
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
|
||||||
GetUserMedia(audio, audio_constraints, video, video_constraints);
|
GetUserMedia(audio, audio_constraints, video, video_constraints);
|
||||||
EXPECT_TRUE(peer_connection_->AddStream(stream, NULL));
|
EXPECT_TRUE(peer_connection_->AddStream(stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::scoped_refptr<webrtc::MediaStreamInterface>
|
rtc::scoped_refptr<webrtc::MediaStreamInterface>
|
||||||
|
@@ -57,7 +57,6 @@ class PeerConnectionTestWrapper
|
|||||||
const webrtc::DataChannelInit& init);
|
const webrtc::DataChannelInit& init);
|
||||||
|
|
||||||
// Implements PeerConnectionObserver.
|
// Implements PeerConnectionObserver.
|
||||||
virtual void OnError() {}
|
|
||||||
virtual void OnSignalingChange(
|
virtual void OnSignalingChange(
|
||||||
webrtc::PeerConnectionInterface::SignalingState new_state) {}
|
webrtc::PeerConnectionInterface::SignalingState new_state) {}
|
||||||
virtual void OnStateChange(
|
virtual void OnStateChange(
|
||||||
|
@@ -110,7 +110,7 @@ public class PeerConnectionClient {
|
|||||||
if (videoConstraints != null) {
|
if (videoConstraints != null) {
|
||||||
videoMediaStream = factory.createLocalMediaStream("ARDAMSVideo");
|
videoMediaStream = factory.createLocalMediaStream("ARDAMSVideo");
|
||||||
videoMediaStream.addTrack(createVideoTrack(useFrontFacingCamera));
|
videoMediaStream.addTrack(createVideoTrack(useFrontFacingCamera));
|
||||||
pc.addStream(videoMediaStream, new MediaConstraints());
|
pc.addStream(videoMediaStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appRtcParameters.audioConstraints != null) {
|
if (appRtcParameters.audioConstraints != null) {
|
||||||
@@ -118,7 +118,7 @@ public class PeerConnectionClient {
|
|||||||
lMS.addTrack(factory.createAudioTrack(
|
lMS.addTrack(factory.createAudioTrack(
|
||||||
"ARDAMSa0",
|
"ARDAMSa0",
|
||||||
factory.createAudioSource(appRtcParameters.audioConstraints)));
|
factory.createAudioSource(appRtcParameters.audioConstraints)));
|
||||||
pc.addStream(lMS, new MediaConstraints());
|
pc.addStream(lMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ public class PeerConnectionClient {
|
|||||||
useFrontFacingCamera = !useFrontFacingCamera;
|
useFrontFacingCamera = !useFrontFacingCamera;
|
||||||
VideoTrack newTrack = createVideoTrack(useFrontFacingCamera);
|
VideoTrack newTrack = createVideoTrack(useFrontFacingCamera);
|
||||||
videoMediaStream.addTrack(newTrack);
|
videoMediaStream.addTrack(newTrack);
|
||||||
pc.addStream(videoMediaStream, new MediaConstraints());
|
pc.addStream(videoMediaStream);
|
||||||
|
|
||||||
SessionDescription remoteDesc = pc.getRemoteDescription();
|
SessionDescription remoteDesc = pc.getRemoteDescription();
|
||||||
if (localSdp == null || remoteDesc == null) {
|
if (localSdp == null || remoteDesc == null) {
|
||||||
@@ -440,11 +440,6 @@ public class PeerConnectionClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
reportError("PeerConnection error!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSignalingChange(
|
public void onSignalingChange(
|
||||||
PeerConnection.SignalingState newState) {
|
PeerConnection.SignalingState newState) {
|
||||||
|
@@ -170,7 +170,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
[lms addAudioTrack:[self.peerConnectionFactory audioTrackWithID:@"ARDAMSa0"]];
|
[lms addAudioTrack:[self.peerConnectionFactory audioTrackWithID:@"ARDAMSa0"]];
|
||||||
[self.peerConnection addStream:lms constraints:constraints];
|
[self.peerConnection addStream:lms];
|
||||||
[self.logger logMessage:@"onICEServers - added local stream."];
|
[self.logger logMessage:@"onICEServers - added local stream."];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,16 +243,6 @@
|
|||||||
|
|
||||||
#pragma mark - RTCPeerConnectionDelegate
|
#pragma mark - RTCPeerConnectionDelegate
|
||||||
|
|
||||||
- (void)peerConnectionOnError:(RTCPeerConnection*)peerConnection {
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
NSString* message = @"PeerConnection error";
|
|
||||||
NSLog(@"%@", message);
|
|
||||||
NSAssert(NO, @"PeerConnection failed.");
|
|
||||||
[self.delegate connectionManager:self
|
|
||||||
didErrorWithMessage:message];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)peerConnection:(RTCPeerConnection*)peerConnection
|
- (void)peerConnection:(RTCPeerConnection*)peerConnection
|
||||||
signalingStateChanged:(RTCSignalingState)stateChanged {
|
signalingStateChanged:(RTCSignalingState)stateChanged {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
@@ -137,11 +137,6 @@ void Conductor::EnsureStreamingUI() {
|
|||||||
// PeerConnectionObserver implementation.
|
// PeerConnectionObserver implementation.
|
||||||
//
|
//
|
||||||
|
|
||||||
void Conductor::OnError() {
|
|
||||||
LOG(LS_ERROR) << __FUNCTION__;
|
|
||||||
main_wnd_->QueueUIThreadCallback(PEER_CONNECTION_ERROR, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when a remote stream is added
|
// Called when a remote stream is added
|
||||||
void Conductor::OnAddStream(webrtc::MediaStreamInterface* stream) {
|
void Conductor::OnAddStream(webrtc::MediaStreamInterface* stream) {
|
||||||
LOG(INFO) << __FUNCTION__ << " " << stream->label();
|
LOG(INFO) << __FUNCTION__ << " " << stream->label();
|
||||||
@@ -373,7 +368,7 @@ void Conductor::AddStreams() {
|
|||||||
|
|
||||||
stream->AddTrack(audio_track);
|
stream->AddTrack(audio_track);
|
||||||
stream->AddTrack(video_track);
|
stream->AddTrack(video_track);
|
||||||
if (!peer_connection_->AddStream(stream, NULL)) {
|
if (!peer_connection_->AddStream(stream)) {
|
||||||
LOG(LS_ERROR) << "Adding stream to PeerConnection failed";
|
LOG(LS_ERROR) << "Adding stream to PeerConnection failed";
|
||||||
}
|
}
|
||||||
typedef std::pair<std::string,
|
typedef std::pair<std::string,
|
||||||
@@ -440,10 +435,6 @@ void Conductor::UIThreadCallback(int msg_id, void* data) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PEER_CONNECTION_ERROR:
|
|
||||||
main_wnd_->MessageBox("Error", "an unknown error occurred", true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NEW_STREAM_ADDED: {
|
case NEW_STREAM_ADDED: {
|
||||||
webrtc::MediaStreamInterface* stream =
|
webrtc::MediaStreamInterface* stream =
|
||||||
reinterpret_cast<webrtc::MediaStreamInterface*>(
|
reinterpret_cast<webrtc::MediaStreamInterface*>(
|
||||||
|
@@ -58,7 +58,6 @@ class Conductor
|
|||||||
MEDIA_CHANNELS_INITIALIZED = 1,
|
MEDIA_CHANNELS_INITIALIZED = 1,
|
||||||
PEER_CONNECTION_CLOSED,
|
PEER_CONNECTION_CLOSED,
|
||||||
SEND_MESSAGE_TO_PEER,
|
SEND_MESSAGE_TO_PEER,
|
||||||
PEER_CONNECTION_ERROR,
|
|
||||||
NEW_STREAM_ADDED,
|
NEW_STREAM_ADDED,
|
||||||
STREAM_REMOVED,
|
STREAM_REMOVED,
|
||||||
};
|
};
|
||||||
@@ -80,11 +79,11 @@ class Conductor
|
|||||||
//
|
//
|
||||||
// PeerConnectionObserver implementation.
|
// PeerConnectionObserver implementation.
|
||||||
//
|
//
|
||||||
virtual void OnError();
|
|
||||||
virtual void OnStateChange(
|
virtual void OnStateChange(
|
||||||
webrtc::PeerConnectionObserver::StateType state_changed) {}
|
webrtc::PeerConnectionObserver::StateType state_changed) {}
|
||||||
virtual void OnAddStream(webrtc::MediaStreamInterface* stream);
|
virtual void OnAddStream(webrtc::MediaStreamInterface* stream);
|
||||||
virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream);
|
virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream);
|
||||||
|
virtual void OnDataChannel(webrtc::DataChannelInterface* channel) {}
|
||||||
virtual void OnRenegotiationNeeded() {}
|
virtual void OnRenegotiationNeeded() {}
|
||||||
virtual void OnIceChange() {}
|
virtual void OnIceChange() {}
|
||||||
virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate);
|
virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate);
|
||||||
|
Reference in New Issue
Block a user