Chromium Code Reviews| 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/webrtc/webrtc_media_stream_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_media_stream_adapter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/media/media_stream_audio_track.h" | 8 #include "content/renderer/media/media_stream_audio_track.h" |
| 9 #include "content/renderer/media/media_stream_track.h" | 9 #include "content/renderer/media/media_stream_track.h" |
| 10 #include "content/renderer/media/webrtc/media_stream_video_webrtc_sink.h" | 10 #include "content/renderer/media/webrtc/media_stream_video_webrtc_sink.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 | 94 |
| 95 for (auto it = video_sinks_.begin(); it != video_sinks_.end(); ++it) { | 95 for (auto it = video_sinks_.begin(); it != video_sinks_.end(); ++it) { |
| 96 if ((*it)->webrtc_video_track() == webrtc_track.get()) { | 96 if ((*it)->webrtc_video_track() == webrtc_track.get()) { |
| 97 video_sinks_.erase(it); | 97 video_sinks_.erase(it); |
| 98 break; | 98 break; |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 // TODO(hbos): Replace this code with using |WebRtcMediaStreamTrackAdapter|. | |
|
Guido Urdaneta
2017/05/30 08:45:35
nit: s/using// ?
hbos_chromium
2017/05/30 09:20:09
Done.
| |
| 105 // crbug.com/705901 | |
| 104 void WebRtcMediaStreamAdapter::AddAudioSinkToTrack( | 106 void WebRtcMediaStreamAdapter::AddAudioSinkToTrack( |
| 105 const blink::WebMediaStreamTrack& track) { | 107 const blink::WebMediaStreamTrack& track) { |
| 106 MediaStreamAudioTrack* native_track = MediaStreamAudioTrack::From(track); | 108 MediaStreamAudioTrack* native_track = MediaStreamAudioTrack::From(track); |
| 107 if (!native_track) { | 109 if (!native_track) { |
| 108 DLOG(ERROR) << "No native track for blink audio track."; | 110 DLOG(ERROR) << "No native track for blink audio track."; |
| 109 return; | 111 return; |
| 110 } | 112 } |
| 111 | 113 |
| 112 // Non-WebRtc remote sources and local sources do not provide an instance of | 114 // Non-WebRtc remote sources and local sources do not provide an instance of |
| 113 // the webrtc::AudioSourceInterface, and also do not need references to the | 115 // the webrtc::AudioSourceInterface, and also do not need references to the |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 127 if (processor && processor->has_audio_processing()) | 129 if (processor && processor->has_audio_processing()) |
| 128 audio_sink->SetAudioProcessor(processor); | 130 audio_sink->SetAudioProcessor(processor); |
| 129 } | 131 } |
| 130 } | 132 } |
| 131 | 133 |
| 132 audio_sinks_.push_back(std::unique_ptr<WebRtcAudioSink>(audio_sink)); | 134 audio_sinks_.push_back(std::unique_ptr<WebRtcAudioSink>(audio_sink)); |
| 133 native_track->AddSink(audio_sink); | 135 native_track->AddSink(audio_sink); |
| 134 webrtc_media_stream_->AddTrack(audio_sink->webrtc_audio_track()); | 136 webrtc_media_stream_->AddTrack(audio_sink->webrtc_audio_track()); |
| 135 } | 137 } |
| 136 | 138 |
| 139 // TODO(hbos): Replace this code with using |WebRtcMediaStreamTrackAdapter|. | |
| 140 // crbug.com/705901 | |
| 137 void WebRtcMediaStreamAdapter::AddVideoSinkToTrack( | 141 void WebRtcMediaStreamAdapter::AddVideoSinkToTrack( |
| 138 const blink::WebMediaStreamTrack& track) { | 142 const blink::WebMediaStreamTrack& track) { |
| 139 DCHECK_EQ(track.Source().GetType(), blink::WebMediaStreamSource::kTypeVideo); | 143 DCHECK_EQ(track.Source().GetType(), blink::WebMediaStreamSource::kTypeVideo); |
| 140 MediaStreamVideoWebRtcSink* video_sink = | 144 MediaStreamVideoWebRtcSink* video_sink = |
| 141 new MediaStreamVideoWebRtcSink(track, factory_); | 145 new MediaStreamVideoWebRtcSink(track, factory_); |
| 142 video_sinks_.push_back( | 146 video_sinks_.push_back( |
| 143 std::unique_ptr<MediaStreamVideoWebRtcSink>(video_sink)); | 147 std::unique_ptr<MediaStreamVideoWebRtcSink>(video_sink)); |
| 144 webrtc_media_stream_->AddTrack(video_sink->webrtc_video_track()); | 148 webrtc_media_stream_->AddTrack(video_sink->webrtc_video_track()); |
| 145 } | 149 } |
| 146 | 150 |
| 147 } // namespace content | 151 } // namespace content |
| OLD | NEW |