Skip to content

Commit

Permalink
Format the source code.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchao-xu committed Nov 3, 2023
1 parent 3182fc6 commit 1f40013
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import 'dart:html';

class SimpleWebSocket {

SimpleWebSocket(this._url) {
_url = _url.replaceAll('https:', 'wss:');
}
Expand Down
3 changes: 1 addition & 2 deletions packages/flutter_webrtc/tizen/inc/flutter_video_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class FlutterVideoRenderer
FlutterVideoRenderer() = default;
~FlutterVideoRenderer();

void initialize(TextureRegistrar* registrar,
BinaryMessenger* messenger,
void initialize(TextureRegistrar* registrar, BinaryMessenger* messenger,
std::unique_ptr<flutter::TextureVariant> texture,
int64_t texture_id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,24 @@ struct fixed_function_vtable<construct_type::copy_and_move, Ret, Args...>

} // namespace details

template <typename Function,
size_t MaxSize = 128,
template <typename Function, size_t MaxSize = 128,
construct_type ConstructStrategy = construct_type::copy_and_move>
class fixed_size_function;

template <typename Ret,
typename... Args,
size_t MaxSize,
template <typename Ret, typename... Args, size_t MaxSize,
construct_type ConstructStrategy>
class fixed_size_function<Ret(Args...), MaxSize, ConstructStrategy> {
public:
// Compile-time information

using is_copyable =
std::integral_constant<bool,
ConstructStrategy == construct_type::copy ||
ConstructStrategy ==
construct_type::copy_and_move>;
std::integral_constant<bool, ConstructStrategy == construct_type::copy ||
ConstructStrategy ==
construct_type::copy_and_move>;
using is_movable =
std::integral_constant<bool,
ConstructStrategy == construct_type::move ||
ConstructStrategy ==
construct_type::copy_and_move>;
std::integral_constant<bool, ConstructStrategy == construct_type::move ||
ConstructStrategy ==
construct_type::copy_and_move>;

using result_type = Ret;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ class string {
}
};

inline std::string to_std_string(const string& str) {
return str.std_string();
}
inline std::string to_std_string(const string& str) { return str.std_string(); }

template <typename T>
class identity {
Expand Down Expand Up @@ -244,8 +242,7 @@ class map {
}*/

template <typename K2, typename KC, typename V2, typename VC>
static my_pair* to_array(const std::map<K2, V2>& m,
KC convertKey,
static my_pair* to_array(const std::map<K2, V2>& m, KC convertKey,
VC convertValue) {
my_pair* data = new my_pair[m.size()];
my_pair* dp = data;
Expand Down Expand Up @@ -278,8 +275,7 @@ class map {
: m_vec(to_array(m, identity<K>(), identity<V>()), m.size()) {}

template <typename K2, typename KC, typename V2, typename VC>
map(const std::map<K2, V2>& m,
KC convertKey = identity<K>(),
map(const std::map<K2, V2>& m, KC convertKey = identity<K>(),
VC convertValue = identity<V>())
: m_vec(to_array(m, convertKey, convertValue), m.size()) {}

Expand Down Expand Up @@ -320,8 +316,7 @@ class map {
const my_pair* get(K2 key, int (*cmp)(K2, const K&)) const {
for (size_t i = 0; i < m_vec.size(); ++i) {
const my_pair* dp = m_vec.data() + i;
if (!cmp(key, dp->key))
return dp;
if (!cmp(key, dp->key)) return dp;
}
return 0;
}
Expand Down Expand Up @@ -428,14 +423,12 @@ class local_ptr {
: m_ptr(0), m_destroy(0) {} // copying does not persist value
local_ptr& operator=(const local_ptr&) { return *this; }
~local_ptr() {
if (m_ptr)
m_destroy(m_ptr);
if (m_ptr) m_destroy(m_ptr);
}
const T* get() const { return m_ptr; }
T* get() { return m_ptr; }
void set(T* ptr, void (*dtor)(T*)) {
if (m_ptr)
m_destroy(m_ptr);
if (m_ptr) m_destroy(m_ptr);
m_ptr = ptr;
m_destroy = dtor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class RefCountedObject : public T {

template <class P0, class P1, class... Args>
RefCountedObject(P0&& p0, P1&& p1, Args&&... args)
: T(std::forward<P0>(p0),
std::forward<P1>(p1),
: T(std::forward<P0>(p0), std::forward<P1>(p1),
std::forward<Args>(args)...) {}

virtual int AddRef() const { return AtomicOps::Increment(&ref_count_); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,16 @@ class scoped_refptr {
scoped_refptr() : ptr_(NULL) {}

scoped_refptr(T* p) : ptr_(p) {
if (ptr_)
ptr_->AddRef();
if (ptr_) ptr_->AddRef();
}

scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
if (ptr_)
ptr_->AddRef();
if (ptr_) ptr_->AddRef();
}

template <typename U>
scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
if (ptr_)
ptr_->AddRef();
if (ptr_) ptr_->AddRef();
}

// Move constructors.
Expand All @@ -95,8 +92,7 @@ class scoped_refptr {
scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.release()) {}

~scoped_refptr() {
if (ptr_)
ptr_->Release();
if (ptr_) ptr_->Release();
}

T* get() const { return ptr_; }
Expand All @@ -116,10 +112,8 @@ class scoped_refptr {

scoped_refptr<T>& operator=(T* p) {
// AddRef first so that self assignment should work
if (p)
p->AddRef();
if (ptr_)
ptr_->Release();
if (p) p->AddRef();
if (ptr_) ptr_->Release();
ptr_ = p;
return *this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class AudioFrame {
* @param num_channels: the number of audio channels.
* @return AudioFrame*: a pointer to the newly created AudioFrame.
*/
MEDIA_MANAGER_API static AudioFrame* Create(int id,
uint32_t timestamp,
MEDIA_MANAGER_API static AudioFrame* Create(int id, uint32_t timestamp,
const int16_t* data,
size_t samples_per_channel,
int sample_rate_hz,
Expand All @@ -45,11 +44,8 @@ class AudioFrame {
* @param sample_rate_hz: the sample rate in Hz.
* @param num_channels: the number of audio channels.
*/
virtual void UpdateFrame(int id,
uint32_t timestamp,
const int16_t* data,
size_t samples_per_channel,
int sample_rate_hz,
virtual void UpdateFrame(int id, uint32_t timestamp, const int16_t* data,
size_t samples_per_channel, int sample_rate_hz,
size_t num_channels = 1) = 0;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class RTCDataChannel : public RefCountInterface {
* The data buffer, its size, and a boolean indicating whether the data is
* binary are passed as parameters.
*/
virtual void Send(const uint8_t* data,
uint32_t size,
virtual void Send(const uint8_t* data, uint32_t size,
bool binary = false) = 0;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ class RTCDesktopCapturer : public RefCountInterface {
*
* @return The current capture state after attempting to start capture.
*/
virtual CaptureState Start(uint32_t fps,
uint32_t x,
uint32_t y,
uint32_t w,
virtual CaptureState Start(uint32_t fps, uint32_t x, uint32_t y, uint32_t w,
uint32_t h) = 0;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ class RTCDtmfSender : public RefCountInterface {

virtual void UnregisterObserver() = 0;

virtual bool InsertDtmf(const string tones,
int duration,
virtual bool InsertDtmf(const string tones, int duration,
int inter_tone_gap) = 0;

virtual bool InsertDtmf(const string tones,
int duration,
int inter_tone_gap,
virtual bool InsertDtmf(const string tones, int duration, int inter_tone_gap,
int comma_delay) = 0;

virtual bool CanInsertDtmf() = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class KeyProvider : public RefCountInterface {
virtual vector<uint8_t> ExportSharedKey(int key_index) = 0;

/// Set the key at the given index.
virtual bool SetKey(const string participant_id,
int index,
virtual bool SetKey(const string participant_id, int index,
vector<uint8_t> key) = 0;

virtual vector<uint8_t> RatchetKey(const string participant_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ namespace libwebrtc {
class RTCIceCandidate : public RefCountInterface {
public:
static LIB_WEBRTC_API scoped_refptr<RTCIceCandidate> Create(
const string sdp,
const string sdp_mid,
int sdp_mline_index,
const string sdp, const string sdp_mid, int sdp_mline_index,
SdpParseError* error);

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ class IceTransportFactory {
virtual ~IceTransportFactory() = default;

virtual scoped_refptr<IceTransport> CreateIceTransport(
const std::string& transport_name,
int component,
const std::string& transport_name, int component,
IceTransportInit init) = 0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ class RTCPeerConnection : public RefCountInterface {
const string stream_id) = 0;

virtual scoped_refptr<RTCDataChannel> CreateDataChannel(
const string label,
RTCDataChannelInit* dataChannelDict) = 0;
const string label, RTCDataChannelInit* dataChannelDict) = 0;

virtual void CreateOffer(OnSdpCreateSuccess success,
OnSdpCreateFailure failure,
Expand All @@ -194,13 +193,11 @@ class RTCPeerConnection : public RefCountInterface {

virtual void Close() = 0;

virtual void SetLocalDescription(const string sdp,
const string type,
virtual void SetLocalDescription(const string sdp, const string type,
OnSetSdpSuccess success,
OnSetSdpFailure failure) = 0;

virtual void SetRemoteDescription(const string sdp,
const string type,
virtual void SetRemoteDescription(const string sdp, const string type,
OnSetSdpSuccess success,
OnSetSdpFailure failure) = 0;

Expand All @@ -210,8 +207,7 @@ class RTCPeerConnection : public RefCountInterface {
virtual void GetRemoteDescription(OnGetSdpSuccess success,
OnGetSdpFailure failure) = 0;

virtual void AddCandidate(const string mid,
int mid_mline_index,
virtual void AddCandidate(const string mid, int mid_mline_index,
const string candiate) = 0;

virtual void RegisterRTCPeerConnectionObserver(
Expand Down Expand Up @@ -242,15 +238,13 @@ class RTCPeerConnection : public RefCountInterface {
scoped_refptr<RTCMediaTrack> track) = 0;

virtual scoped_refptr<RTCRtpSender> AddTrack(
scoped_refptr<RTCMediaTrack> track,
const vector<string> streamIds) = 0;
scoped_refptr<RTCMediaTrack> track, const vector<string> streamIds) = 0;

virtual scoped_refptr<RTCRtpTransceiver> AddTransceiver(
RTCMediaType media_type) = 0;

virtual scoped_refptr<RTCRtpTransceiver> AddTransceiver(
RTCMediaType media_type,
scoped_refptr<RTCRtpTransceiverInit> init) = 0;
RTCMediaType media_type, scoped_refptr<RTCRtpTransceiverInit> init) = 0;

virtual bool RemoveTrack(scoped_refptr<RTCRtpSender> render) = 0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef LIB_WEBRTC_RTC_PEERCONNECTION_FACTORY_HXX
#define LIB_WEBRTC_RTC_PEERCONNECTION_FACTORY_HXX

#include "rtc_types.h"

#include "rtc_audio_source.h"
#include "rtc_audio_track.h"
#include "rtc_types.h"
#ifdef RTC_DESKTOP_DEVICE
#include "rtc_desktop_device.h"
#endif
Expand Down Expand Up @@ -42,8 +41,7 @@ class RTCPeerConnectionFactory : public RefCountInterface {
const string audio_source_label) = 0;

virtual scoped_refptr<RTCVideoSource> CreateVideoSource(
scoped_refptr<RTCVideoCapturer> capturer,
const string video_source_label,
scoped_refptr<RTCVideoCapturer> capturer, const string video_source_label,
scoped_refptr<RTCMediaConstraints> constraints) = 0;
#ifdef RTC_DESKTOP_DEVICE
virtual scoped_refptr<RTCVideoSource> CreateDesktopSource(
Expand All @@ -52,12 +50,10 @@ class RTCPeerConnectionFactory : public RefCountInterface {
scoped_refptr<RTCMediaConstraints> constraints) = 0;
#endif
virtual scoped_refptr<RTCAudioTrack> CreateAudioTrack(
scoped_refptr<RTCAudioSource> source,
const string track_id) = 0;
scoped_refptr<RTCAudioSource> source, const string track_id) = 0;

virtual scoped_refptr<RTCVideoTrack> CreateVideoTrack(
scoped_refptr<RTCVideoSource> source,
const string track_id) = 0;
scoped_refptr<RTCVideoSource> source, const string track_id) = 0;

virtual scoped_refptr<RTCMediaStream> CreateStream(
const string stream_id) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "base/refcount.h"
#include "base/scoped_ref_ptr.h"

#include "rtc_rtp_parameters.h"
#include "rtc_types.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "base/refcount.h"
#include "base/scoped_ref_ptr.h"

#include "rtc_types.h"

namespace libwebrtc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "base/refcount.h"
#include "base/scoped_ref_ptr.h"

#include "rtc_rtp_parameters.h"
#include "rtc_types.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "base/refcount.h"
#include "base/scoped_ref_ptr.h"

#include "rtc_rtp_parameters.h"
#include "rtc_types.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ namespace libwebrtc {
class RTCRtpTransceiverInit : public RefCountInterface {
public:
LIB_WEBRTC_API static scoped_refptr<RTCRtpTransceiverInit> Create(
RTCRtpTransceiverDirection direction,
const vector<string> stream_ids,
RTCRtpTransceiverDirection direction, const vector<string> stream_ids,
const vector<scoped_refptr<RTCRtpEncodingParameters>> encodings);

virtual RTCRtpTransceiverDirection direction() = 0;
Expand Down
Loading

0 comments on commit 1f40013

Please sign in to comment.