| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_renderer_factory_impl.h" | 5 #include "content/renderer/media/media_stream_renderer_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/renderer/media/media_stream.h" | 8 #include "content/renderer/media/media_stream.h" |
| 9 #include "content/renderer/media/media_stream_audio_track.h" | 9 #include "content/renderer/media/media_stream_audio_track.h" |
| 10 #include "content/renderer/media/media_stream_video_renderer_sink.h" | 10 #include "content/renderer/media/media_stream_video_renderer_sink.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 DVLOG(1) << "MediaStreamRendererFactoryImpl::GetAudioRenderer stream:" | 102 DVLOG(1) << "MediaStreamRendererFactoryImpl::GetAudioRenderer stream:" |
| 103 << base::UTF16ToUTF8(base::StringPiece16(web_stream.id())); | 103 << base::UTF16ToUTF8(base::StringPiece16(web_stream.id())); |
| 104 | 104 |
| 105 // TODO(tommi): We need to fix the data flow so that | 105 // TODO(tommi): We need to fix the data flow so that |
| 106 // it works the same way for all track implementations, local, remote or what | 106 // it works the same way for all track implementations, local, remote or what |
| 107 // have you. | 107 // have you. |
| 108 // In this function, we should simply create a renderer object that receives | 108 // In this function, we should simply create a renderer object that receives |
| 109 // and mixes audio from all the tracks that belong to the media stream. | 109 // and mixes audio from all the tracks that belong to the media stream. |
| 110 // For now, we have separate renderers depending on if the first audio track | 110 // For now, we have separate renderers depending on if the first audio track |
| 111 // in the stream is local or remote. | 111 // in the stream is local or remote. |
| 112 MediaStreamAudioTrack* audio_track = MediaStreamAudioTrack::GetTrack( | 112 MediaStreamAudioTrack* audio_track = |
| 113 audio_tracks[0]); | 113 MediaStreamAudioTrack::From(audio_tracks[0]); |
| 114 if (!audio_track) { | 114 if (!audio_track) { |
| 115 // This can happen if the track was cloned. | 115 // This can happen if the track was cloned. |
| 116 // TODO(tommi, perkj): Fix cloning of tracks to handle extra data too. | 116 // TODO(tommi, perkj): Fix cloning of tracks to handle extra data too. |
| 117 LOG(ERROR) << "No native track for WebMediaStreamTrack."; | 117 LOG(ERROR) << "No native track for WebMediaStreamTrack."; |
| 118 return nullptr; | 118 return nullptr; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // If the track has a local source, or is a remote track that does not use the | 121 // If the track has a local source, or is a remote track that does not use the |
| 122 // WebRTC audio pipeline, return a new TrackAudioRenderer instance. | 122 // WebRTC audio pipeline, return a new TrackAudioRenderer instance. |
| 123 // | 123 // |
| (...skipping 28 matching lines...) Expand all Loading... |
| 152 device_id, security_origin); | 152 device_id, security_origin); |
| 153 | 153 |
| 154 if (!audio_device->SetAudioRenderer(renderer.get())) | 154 if (!audio_device->SetAudioRenderer(renderer.get())) |
| 155 return nullptr; | 155 return nullptr; |
| 156 } | 156 } |
| 157 | 157 |
| 158 return renderer->CreateSharedAudioRendererProxy(web_stream); | 158 return renderer->CreateSharedAudioRendererProxy(web_stream); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace content | 161 } // namespace content |
| OLD | NEW |