1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef THIRD_PARTY_LIBJINGLE_OVERRIDES_INIT_WEBRTC_H_
6 #define THIRD_PARTY_LIBJINGLE_OVERRIDES_INIT_WEBRTC_H_
10 #include "allocator_shim/allocator_stub.h"
11 #include "base/logging.h"
12 #include "third_party/webrtc/system_wrappers/interface/event_tracer.h"
19 class MediaEngineInterface
;
20 class WebRtcVideoDecoderFactory
;
21 class WebRtcVideoEncoderFactory
;
22 } // namespace cricket
25 class AudioDeviceModule
;
28 } // namespace metrics
31 typedef std::string (*FieldTrialFindFullName
)(const std::string
& trial_name
);
33 typedef webrtc::metrics::Histogram
* (*RtcHistogramFactoryGetCounts
)(
34 const std::string
& name
, int min
, int max
, int bucket_count
);
35 typedef webrtc::metrics::Histogram
* (*RtcHistogramFactoryGetEnumeration
)(
36 const std::string
& name
, int boundary
);
37 typedef void (*RtcHistogramAdd
)(
38 webrtc::metrics::Histogram
* histogram_pointer
,
39 const std::string
& name
,
42 typedef cricket::MediaEngineInterface
* (*CreateWebRtcMediaEngineFunction
)(
43 webrtc::AudioDeviceModule
* adm
,
44 webrtc::AudioDeviceModule
* adm_sc
,
45 cricket::WebRtcVideoEncoderFactory
* encoder_factory
,
46 cricket::WebRtcVideoDecoderFactory
* decoder_factory
);
48 typedef void (*DestroyWebRtcMediaEngineFunction
)(
49 cricket::MediaEngineInterface
* media_engine
);
51 typedef void (*InitDiagnosticLoggingDelegateFunctionFunction
)(
52 void (*DelegateFunction
)(const std::string
&));
54 // A typedef for the main initialize function in libpeerconnection.
55 // This will initialize logging in the module with the proper arguments
56 // as well as provide pointers back to a couple webrtc factory functions.
57 // The reason we get pointers to these functions this way is to avoid having
58 // to go through GetProcAddress et al and rely on specific name mangling.
59 // TODO(tommi): The number of functions is growing. Use a struct.
60 typedef bool (*InitializeModuleFunction
)(
61 const base::CommandLine
& command_line
,
62 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
63 AllocateFunction alloc
,
64 DellocateFunction dealloc
,
66 FieldTrialFindFullName field_trial_find
,
67 RtcHistogramFactoryGetCounts factory_get_counts
,
68 RtcHistogramFactoryGetEnumeration factory_get_enumeration
,
69 RtcHistogramAdd histogram_add
,
70 logging::LogMessageHandlerFunction log_handler
,
71 webrtc::GetCategoryEnabledPtr trace_get_category_enabled
,
72 webrtc::AddTraceEventPtr trace_add_trace_event
,
73 CreateWebRtcMediaEngineFunction
* create_media_engine
,
74 DestroyWebRtcMediaEngineFunction
* destroy_media_engine
,
75 InitDiagnosticLoggingDelegateFunctionFunction
* init_diagnostic_logging
);
77 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION)
78 // Load and initialize the shared WebRTC module (libpeerconnection).
79 // Call this explicitly to load and initialize the WebRTC module (e.g. before
80 // initializing the sandbox in Chrome).
81 // If not called explicitly, this function will still be called from the main
82 // CreateWebRtcMediaEngine factory function the first time it is called.
83 bool InitializeWebRtcModule();
86 #endif // THIRD_PARTY_LIBJINGLE_OVERRIDES_INIT_WEBRTC_H_