• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef THIRD_PARTY_LIBJINGLE_OVERRIDES_INIT_WEBRTC_H_
6 #define THIRD_PARTY_LIBJINGLE_OVERRIDES_INIT_WEBRTC_H_
7 
8 #include "allocator_shim/allocator_stub.h"
9 #include "base/logging.h"
10 #include "third_party/webrtc/system_wrappers/interface/event_tracer.h"
11 
12 namespace base {
13 class CommandLine;
14 }
15 
16 namespace cricket {
17 class MediaEngineInterface;
18 class WebRtcVideoDecoderFactory;
19 class WebRtcVideoEncoderFactory;
20 }  // namespace cricket
21 
22 namespace webrtc {
23 class AudioDeviceModule;
24 }  // namespace webrtc
25 
26 typedef std::string (*FieldTrialFindFullName)(const std::string& trial_name);
27 
28 typedef cricket::MediaEngineInterface* (*CreateWebRtcMediaEngineFunction)(
29     webrtc::AudioDeviceModule* adm,
30     webrtc::AudioDeviceModule* adm_sc,
31     cricket::WebRtcVideoEncoderFactory* encoder_factory,
32     cricket::WebRtcVideoDecoderFactory* decoder_factory);
33 
34 typedef void (*DestroyWebRtcMediaEngineFunction)(
35     cricket::MediaEngineInterface* media_engine);
36 
37 typedef void (*InitDiagnosticLoggingDelegateFunctionFunction)(
38     void (*DelegateFunction)(const std::string&));
39 
40 // A typedef for the main initialize function in libpeerconnection.
41 // This will initialize logging in the module with the proper arguments
42 // as well as provide pointers back to a couple webrtc factory functions.
43 // The reason we get pointers to these functions this way is to avoid having
44 // to go through GetProcAddress et al and rely on specific name mangling.
45 typedef bool (*InitializeModuleFunction)(
46     const base::CommandLine& command_line,
47 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
48     AllocateFunction alloc,
49     DellocateFunction dealloc,
50 #endif
51     FieldTrialFindFullName field_trial_find,
52     logging::LogMessageHandlerFunction log_handler,
53     webrtc::GetCategoryEnabledPtr trace_get_category_enabled,
54     webrtc::AddTraceEventPtr trace_add_trace_event,
55     CreateWebRtcMediaEngineFunction* create_media_engine,
56     DestroyWebRtcMediaEngineFunction* destroy_media_engine,
57     InitDiagnosticLoggingDelegateFunctionFunction* init_diagnostic_logging);
58 
59 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION)
60 // Load and initialize the shared WebRTC module (libpeerconnection).
61 // Call this explicitly to load and initialize the WebRTC module (e.g. before
62 // initializing the sandbox in Chrome).
63 // If not called explicitly, this function will still be called from the main
64 // CreateWebRtcMediaEngine factory function the first time it is called.
65 bool InitializeWebRtcModule();
66 #endif
67 
68 #endif // THIRD_PARTY_LIBJINGLE_OVERRIDES_INIT_WEBRTC_H_
69