| 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/PtrUtil.h" | 43 #include "wtf/PassOwnPtr.h" |
| 44 #include <memory> | |
| 45 | 44 |
| 46 namespace blink { | 45 namespace blink { |
| 47 | 46 |
| 48 MediaStreamCenter& MediaStreamCenter::instance() | 47 MediaStreamCenter& MediaStreamCenter::instance() |
| 49 { | 48 { |
| 50 ASSERT(isMainThread()); | 49 ASSERT(isMainThread()); |
| 51 DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ()); | 50 DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ()); |
| 52 return center; | 51 return center; |
| 53 } | 52 } |
| 54 | 53 |
| 55 MediaStreamCenter::MediaStreamCenter() | 54 MediaStreamCenter::MediaStreamCenter() |
| 56 : m_private(wrapUnique(Platform::current()->createMediaStreamCenter(this))) | 55 : m_private(adoptPtr(Platform::current()->createMediaStreamCenter(this))) |
| 57 { | 56 { |
| 58 } | 57 } |
| 59 | 58 |
| 60 MediaStreamCenter::~MediaStreamCenter() | 59 MediaStreamCenter::~MediaStreamCenter() |
| 61 { | 60 { |
| 62 } | 61 } |
| 63 | 62 |
| 64 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamComponent* comp
onent) | 63 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamComponent* comp
onent) |
| 65 { | 64 { |
| 66 if (m_private) { | 65 if (m_private) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 m_private->didCreateMediaStream(webStream); | 114 m_private->didCreateMediaStream(webStream); |
| 116 } | 115 } |
| 117 } | 116 } |
| 118 | 117 |
| 119 void MediaStreamCenter::didCreateMediaStreamTrack(MediaStreamComponent* track) | 118 void MediaStreamCenter::didCreateMediaStreamTrack(MediaStreamComponent* track) |
| 120 { | 119 { |
| 121 if (m_private) | 120 if (m_private) |
| 122 m_private->didCreateMediaStreamTrack(track); | 121 m_private->didCreateMediaStreamTrack(track); |
| 123 } | 122 } |
| 124 | 123 |
| 125 std::unique_ptr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFrom
MediaStreamTrack(MediaStreamComponent* track) | 124 PassOwnPtr<AudioSourceProvider> MediaStreamCenter::createWebAudioSourceFromMedia
StreamTrack(MediaStreamComponent* track) |
| 126 { | 125 { |
| 127 ASSERT_UNUSED(track, track); | 126 ASSERT_UNUSED(track, track); |
| 128 if (m_private) | 127 if (m_private) |
| 129 return MediaStreamWebAudioSource::create(wrapUnique(m_private->createWeb
AudioSourceFromMediaStreamTrack(track))); | 128 return MediaStreamWebAudioSource::create(adoptPtr(m_private->createWebAu
dioSourceFromMediaStreamTrack(track))); |
| 130 | 129 |
| 131 return nullptr; | 130 return nullptr; |
| 132 } | 131 } |
| 133 | 132 |
| 134 void MediaStreamCenter::stopLocalMediaStream(const WebMediaStream& webStream) | 133 void MediaStreamCenter::stopLocalMediaStream(const WebMediaStream& webStream) |
| 135 { | 134 { |
| 136 MediaStreamDescriptor* stream = webStream; | 135 MediaStreamDescriptor* stream = webStream; |
| 137 MediaStreamDescriptorClient* client = stream->client(); | 136 MediaStreamDescriptorClient* client = stream->client(); |
| 138 if (client) | 137 if (client) |
| 139 client->streamEnded(); | 138 client->streamEnded(); |
| 140 else | 139 else |
| 141 stream->setEnded(); | 140 stream->setEnded(); |
| 142 } | 141 } |
| 143 | 142 |
| 144 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |