OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "platform/mediastream/MediaStreamDescriptor.h" | 34 #include "platform/mediastream/MediaStreamDescriptor.h" |
35 #include "platform/mediastream/MediaStreamTrackSourcesRequest.h" | 35 #include "platform/mediastream/MediaStreamTrackSourcesRequest.h" |
36 #include "platform/mediastream/MediaStreamWebAudioSource.h" | 36 #include "platform/mediastream/MediaStreamWebAudioSource.h" |
37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
38 #include "public/platform/WebAudioSourceProvider.h" | 38 #include "public/platform/WebAudioSourceProvider.h" |
39 #include "public/platform/WebMediaStream.h" | 39 #include "public/platform/WebMediaStream.h" |
40 #include "public/platform/WebMediaStreamCenter.h" | 40 #include "public/platform/WebMediaStreamCenter.h" |
41 #include "public/platform/WebMediaStreamTrack.h" | 41 #include "public/platform/WebMediaStreamTrack.h" |
42 #include "wtf/Assertions.h" | 42 #include "wtf/Assertions.h" |
43 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PtrUtil.h" |
| 44 #include <memory> |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 MediaStreamCenter& MediaStreamCenter::instance() | 48 MediaStreamCenter& MediaStreamCenter::instance() |
48 { | 49 { |
49 ASSERT(isMainThread()); | 50 ASSERT(isMainThread()); |
50 DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ()); | 51 DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ()); |
51 return center; | 52 return center; |
52 } | 53 } |
53 | 54 |
54 MediaStreamCenter::MediaStreamCenter() | 55 MediaStreamCenter::MediaStreamCenter() |
55 : m_private(adoptPtr(Platform::current()->createMediaStreamCenter(this))) | 56 : m_private(wrapUnique(Platform::current()->createMediaStreamCenter(this))) |
56 { | 57 { |
57 } | 58 } |
58 | 59 |
59 MediaStreamCenter::~MediaStreamCenter() | 60 MediaStreamCenter::~MediaStreamCenter() |
60 { | 61 { |
61 } | 62 } |
62 | 63 |
63 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamComponent* comp
onent) | 64 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamComponent* comp
onent) |
64 { | 65 { |
65 if (m_private) { | 66 if (m_private) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 m_private->didCreateMediaStream(webStream); | 115 m_private->didCreateMediaStream(webStream); |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 void MediaStreamCenter::didCreateMediaStreamTrack(MediaStreamComponent* track) | 119 void MediaStreamCenter::didCreateMediaStreamTrack(MediaStreamComponent* track) |
119 { | 120 { |
120 if (m_private) | 121 if (m_private) |
121 m_private->didCreateMediaStreamTrack(track); | 122 m_private->didCreateMediaStreamTrack(track); |
122 } | 123 } |
123 | 124 |
124 PassOwnPtr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFromMedia
StreamTrack(MediaStreamComponent* track) | 125 std::unique_ptr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFrom
MediaStreamTrack(MediaStreamComponent* track) |
125 { | 126 { |
126 ASSERT_UNUSED(track, track); | 127 ASSERT_UNUSED(track, track); |
127 if (m_private) | 128 if (m_private) |
128 return MediaStreamWebAudioSource::create(adoptPtr(m_private->createWebAu
dioSourceFromMediaStreamTrack(track))); | 129 return MediaStreamWebAudioSource::create(wrapUnique(m_private->createWeb
AudioSourceFromMediaStreamTrack(track))); |
129 | 130 |
130 return nullptr; | 131 return nullptr; |
131 } | 132 } |
132 | 133 |
133 void MediaStreamCenter::stopLocalMediaStream(const WebMediaStream& webStream) | 134 void MediaStreamCenter::stopLocalMediaStream(const WebMediaStream& webStream) |
134 { | 135 { |
135 MediaStreamDescriptor* stream = webStream; | 136 MediaStreamDescriptor* stream = webStream; |
136 MediaStreamDescriptorClient* client = stream->client(); | 137 MediaStreamDescriptorClient* client = stream->client(); |
137 if (client) | 138 if (client) |
138 client->streamEnded(); | 139 client->streamEnded(); |
139 else | 140 else |
140 stream->setEnded(); | 141 stream->setEnded(); |
141 } | 142 } |
142 | 143 |
143 } // namespace blink | 144 } // namespace blink |
OLD | NEW |