Return null from PCFactory#createPeerConnection on failure.

Currently, invalid PeerConnection object is returned. With this change,
null is returned instead. This can be more easily handled in the
application layer.

Bug: webrtc:9440
Change-Id: I44dfee81a681f033b8d336c999d43ff1c69fb015
Reviewed-on: https://webrtc-review.googlesource.com/98480
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24637}
This commit is contained in:
Sami Kalliomäki
2018-09-06 13:21:19 +02:00
committed by Commit Bot
parent 4daf66e71e
commit b33290d082

View File

@ -416,6 +416,9 @@ static jlong JNI_PeerConnectionFactory_CreatePeerConnection(
rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection( rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection(
rtc_config, std::move(peer_connection_dependencies))); rtc_config, std::move(peer_connection_dependencies)));
if (pc == nullptr) {
return 0;
}
return jlongFromPointer( return jlongFromPointer(
new OwnedPeerConnection(pc, std::move(observer), std::move(constraints))); new OwnedPeerConnection(pc, std::move(observer), std::move(constraints)));