Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1289)

Side by Side Diff: third_party/WebKit/Source/platform/mediastream/MediaStreamCenter.cpp

Issue 2791303002: Clone MediaStream video tracks correctly with spec-compliant constraints. (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "platform/mediastream/MediaStreamCenter.h" 32 #include "platform/mediastream/MediaStreamCenter.h"
33 33
34 #include <memory>
35
34 #include "platform/mediastream/MediaStreamDescriptor.h" 36 #include "platform/mediastream/MediaStreamDescriptor.h"
35 #include "platform/mediastream/MediaStreamWebAudioSource.h" 37 #include "platform/mediastream/MediaStreamWebAudioSource.h"
36 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
37 #include "public/platform/WebAudioSourceProvider.h" 39 #include "public/platform/WebAudioSourceProvider.h"
38 #include "public/platform/WebMediaStream.h" 40 #include "public/platform/WebMediaStream.h"
39 #include "public/platform/WebMediaStreamCenter.h" 41 #include "public/platform/WebMediaStreamCenter.h"
40 #include "public/platform/WebMediaStreamTrack.h" 42 #include "public/platform/WebMediaStreamTrack.h"
41 #include "wtf/Assertions.h" 43 #include "wtf/Assertions.h"
42 #include "wtf/PtrUtil.h" 44 #include "wtf/PtrUtil.h"
43 #include <memory>
44 45
45 namespace blink { 46 namespace blink {
46 47
47 MediaStreamCenter& MediaStreamCenter::instance() { 48 MediaStreamCenter& MediaStreamCenter::instance() {
48 ASSERT(isMainThread()); 49 ASSERT(isMainThread());
49 DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ()); 50 DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ());
50 return center; 51 return center;
51 } 52 }
52 53
53 MediaStreamCenter::MediaStreamCenter() 54 MediaStreamCenter::MediaStreamCenter()
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 WebMediaStream webStream(stream); 110 WebMediaStream webStream(stream);
110 m_private->didCreateMediaStream(webStream); 111 m_private->didCreateMediaStream(webStream);
111 } 112 }
112 } 113 }
113 114
114 void MediaStreamCenter::didCreateMediaStreamTrack(MediaStreamComponent* track) { 115 void MediaStreamCenter::didCreateMediaStreamTrack(MediaStreamComponent* track) {
115 if (m_private) 116 if (m_private)
116 m_private->didCreateMediaStreamTrack(track); 117 m_private->didCreateMediaStreamTrack(track);
117 } 118 }
118 119
120 void MediaStreamCenter::didCloneMediaStreamTrack(MediaStreamComponent* original,
121 MediaStreamComponent* clone) {
122 if (m_private)
123 m_private->didCloneMediaStreamTrack(original, clone);
124 }
125
119 void MediaStreamCenter::didSetContentHint(MediaStreamComponent* track) { 126 void MediaStreamCenter::didSetContentHint(MediaStreamComponent* track) {
120 if (m_private) 127 if (m_private)
121 m_private->didSetContentHint(track); 128 m_private->didSetContentHint(track);
122 } 129 }
123 130
124 std::unique_ptr<AudioSourceProvider> 131 std::unique_ptr<AudioSourceProvider>
125 MediaStreamCenter::createWebAudioSourceFromMediaStreamTrack( 132 MediaStreamCenter::createWebAudioSourceFromMediaStreamTrack(
126 MediaStreamComponent* track) { 133 MediaStreamComponent* track) {
127 DCHECK(track); 134 DCHECK(track);
128 if (m_private) { 135 if (m_private) {
129 return MediaStreamWebAudioSource::create(WTF::wrapUnique( 136 return MediaStreamWebAudioSource::create(WTF::wrapUnique(
130 m_private->createWebAudioSourceFromMediaStreamTrack(track))); 137 m_private->createWebAudioSourceFromMediaStreamTrack(track)));
131 } 138 }
132 139
133 return nullptr; 140 return nullptr;
134 } 141 }
135 142
136 void MediaStreamCenter::stopLocalMediaStream(const WebMediaStream& webStream) { 143 void MediaStreamCenter::stopLocalMediaStream(const WebMediaStream& webStream) {
137 MediaStreamDescriptor* stream = webStream; 144 MediaStreamDescriptor* stream = webStream;
138 MediaStreamDescriptorClient* client = stream->client(); 145 MediaStreamDescriptorClient* client = stream->client();
139 if (client) 146 if (client)
140 client->streamEnded(); 147 client->streamEnded();
141 } 148 }
142 149
143 } // namespace blink 150 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698