Use "= default" to denote default constructor or destructor
[WebKit-https.git] / Source / WebCore / platform / mediastream / mac / RealtimeMediaSourceCenterMac.cpp
1 /*
2  * Copyright (C) 2013-2016 Apple, Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer
12  *    in the documentation and/or other materials provided with the
13  *    distribution.
14  * 3. Neither the name of Ericsson nor the names of its contributors
15  *    may be used to endorse or promote products derived from this
16  *    software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #include "config.h"
32
33 #if ENABLE(MEDIA_STREAM)
34 #include "RealtimeMediaSourceCenterMac.h"
35
36 #include "AVAudioSessionCaptureDeviceManager.h"
37 #include "AVCaptureDeviceManager.h"
38 #include "AVVideoCaptureSource.h"
39 #include "CoreAudioCaptureDeviceManager.h"
40 #include "CoreAudioCaptureSource.h"
41 #include "Logging.h"
42 #include "MediaStreamPrivate.h"
43 #include <wtf/MainThread.h>
44
45 namespace WebCore {
46
47 RealtimeMediaSourceCenterMac& RealtimeMediaSourceCenterMac::singleton()
48 {
49     ASSERT(isMainThread());
50     static NeverDestroyed<RealtimeMediaSourceCenterMac> center;
51     return center;
52 }
53
54 RealtimeMediaSourceCenter& RealtimeMediaSourceCenter::platformCenter()
55 {
56     return RealtimeMediaSourceCenterMac::singleton();
57 }
58
59 RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac()
60 {
61     m_supportedConstraints.setSupportsSampleRate(false);
62     m_supportedConstraints.setSupportsSampleSize(false);
63     m_supportedConstraints.setSupportsEchoCancellation(false);
64     m_supportedConstraints.setSupportsGroupId(true);
65 }
66
67 RealtimeMediaSourceCenterMac::~RealtimeMediaSourceCenterMac() = default;
68
69
70 RealtimeMediaSource::AudioCaptureFactory& RealtimeMediaSourceCenterMac::defaultAudioFactory()
71 {
72     return CoreAudioCaptureSource::factory();
73 }
74
75 RealtimeMediaSource::VideoCaptureFactory& RealtimeMediaSourceCenterMac::defaultVideoFactory()
76 {
77     return AVVideoCaptureSource::factory();
78 }
79
80 CaptureDeviceManager& RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager()
81 {
82 #if PLATFORM(MAC)
83     return CoreAudioCaptureDeviceManager::singleton();
84 #else
85     return AVAudioSessionCaptureDeviceManager::singleton();
86 #endif
87 }
88
89 CaptureDeviceManager& RealtimeMediaSourceCenterMac::defaultVideoCaptureDeviceManager()
90 {
91     return AVCaptureDeviceManager::singleton();
92 }
93
94 } // namespace WebCore
95
96 #endif // ENABLE(MEDIA_STREAM)