OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/media_stream_center.h" | 5 #include "content/renderer/media/media_stream_center.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 static webrtc::MediaStreamInterface* GetNativeMediaStream( | 28 static webrtc::MediaStreamInterface* GetNativeMediaStream( |
29 const WebKit::WebMediaStream& stream) { | 29 const WebKit::WebMediaStream& stream) { |
30 MediaStreamExtraData* extra_data = | 30 MediaStreamExtraData* extra_data = |
31 static_cast<MediaStreamExtraData*>(stream.extraData()); | 31 static_cast<MediaStreamExtraData*>(stream.extraData()); |
32 return extra_data->stream(); | 32 return extra_data->stream(); |
33 } | 33 } |
34 | 34 |
35 | |
36 static webrtc::MediaStreamTrackInterface* GetNativeMediaStreamTrack( | 35 static webrtc::MediaStreamTrackInterface* GetNativeMediaStreamTrack( |
37 const WebKit::WebMediaStream& stream, | 36 const WebKit::WebMediaStream& stream, |
38 const WebKit::WebMediaStreamTrack& component) { | 37 const WebKit::WebMediaStreamTrack& component) { |
39 std::string track_id = UTF16ToUTF8(component.id()); | 38 std::string track_id = UTF16ToUTF8(component.id()); |
40 webrtc::MediaStreamInterface* native_stream = GetNativeMediaStream(stream); | 39 webrtc::MediaStreamInterface* native_stream = GetNativeMediaStream(stream); |
41 if (native_stream) { | 40 if (native_stream) { |
42 if (component.source().type() == WebKit::WebMediaStreamSource::TypeAudio) { | 41 if (component.source().type() == WebKit::WebMediaStreamSource::TypeAudio) { |
43 return native_stream->FindAudioTrack(track_id); | 42 return native_stream->FindAudioTrack(track_id); |
44 } | 43 } |
45 if (component.source().type() == WebKit::WebMediaStreamSource::TypeVideo) { | 44 if (component.source().type() == WebKit::WebMediaStreamSource::TypeVideo) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 extra_data->OnLocalStreamStop(); | 91 extra_data->OnLocalStreamStop(); |
93 } | 92 } |
94 | 93 |
95 void MediaStreamCenter::didCreateMediaStream( | 94 void MediaStreamCenter::didCreateMediaStream( |
96 WebKit::WebMediaStream& stream) { | 95 WebKit::WebMediaStream& stream) { |
97 if (!rtc_factory_) | 96 if (!rtc_factory_) |
98 return; | 97 return; |
99 rtc_factory_->CreateNativeLocalMediaStream(&stream); | 98 rtc_factory_->CreateNativeLocalMediaStream(&stream); |
100 } | 99 } |
101 | 100 |
101 bool MediaStreamCenter::didAddMediaStreamTrack( | |
102 const WebKit::WebMediaStream& stream, | |
103 const WebKit::WebMediaStreamTrack& track) { | |
104 if (!rtc_factory_) | |
105 return false; | |
106 | |
107 return rtc_factory_->AddNativeMediaStreamTrack(stream, track); | |
108 } | |
109 | |
110 bool MediaStreamCenter::didRemoveMediaStreamTrack( | |
111 const WebKit::WebMediaStream& stream, | |
112 const WebKit::WebMediaStreamTrack& track) { | |
113 if (!rtc_factory_) | |
114 return false; | |
tommi (sloooow) - chröme
2013/04/11 03:26:05
fix indent
perkj_chrome
2013/04/11 10:12:42
Done.
| |
115 | |
116 return rtc_factory_->RemoveNativeMediaStreamTrack(stream, track); | |
117 } | |
118 | |
102 } // namespace content | 119 } // namespace content |
OLD | NEW |