Add native API for creating AndroidNetworkMonitorFactory.
Moves AndroidNetworkMonitor out of pc folder. Even clients not using PeerConnection seem to be using it and it doesn't have any dependencies to the PeerConnection API. Bug: webrtc:8769 Change-Id: I2bdeff9f5c9925e13388fbc77aa9b264a7583548 Reviewed-on: https://webrtc-review.googlesource.com/53260 Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22051}
This commit is contained in:

committed by
Commit Bot

parent
c453c16dbe
commit
ad148a36ea
25
sdk/android/native_api/base/networkmonitor.cc
Normal file
25
sdk/android/native_api/base/networkmonitor.cc
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2018 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.
|
||||
*/
|
||||
|
||||
#include "sdk/android/native_api/base/networkmonitor.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "rtc_base/ptr_util.h"
|
||||
#include "sdk/android/src/jni/androidnetworkmonitor.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
std::unique_ptr<rtc::NetworkMonitorFactory>
|
||||
CreateAndroidNetworkMonitorFactory() {
|
||||
return rtc::MakeUnique<jni::AndroidNetworkMonitorFactory>();
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
29
sdk/android/native_api/base/networkmonitor.h
Normal file
29
sdk/android/native_api/base/networkmonitor.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2018 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.
|
||||
*/
|
||||
|
||||
#ifndef SDK_ANDROID_NATIVE_API_BASE_NETWORKMONITOR_H_
|
||||
#define SDK_ANDROID_NATIVE_API_BASE_NETWORKMONITOR_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "rtc_base/networkmonitor.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Creates an Android-specific network monitor, which is capable of detecting
|
||||
// network changes as soon as they occur, requesting a cellular interface
|
||||
// (dependent on permissions), and binding sockets to network interfaces (more
|
||||
// reliable than binding to IP addresses on Android).
|
||||
std::unique_ptr<rtc::NetworkMonitorFactory>
|
||||
CreateAndroidNetworkMonitorFactory();
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // SDK_ANDROID_NATIVE_API_BASE_NETWORKMONITOR_H_
|
Reference in New Issue
Block a user