| 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/webrtc_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_audio_renderer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 } | 547 } |
| 548 | 548 |
| 549 void WebRtcAudioRenderer::OnPlayStateChanged( | 549 void WebRtcAudioRenderer::OnPlayStateChanged( |
| 550 const blink::WebMediaStream& media_stream, | 550 const blink::WebMediaStream& media_stream, |
| 551 PlayingState* state) { | 551 PlayingState* state) { |
| 552 DCHECK(thread_checker_.CalledOnValidThread()); | 552 DCHECK(thread_checker_.CalledOnValidThread()); |
| 553 blink::WebVector<blink::WebMediaStreamTrack> web_tracks; | 553 blink::WebVector<blink::WebMediaStreamTrack> web_tracks; |
| 554 media_stream.audioTracks(web_tracks); | 554 media_stream.audioTracks(web_tracks); |
| 555 | 555 |
| 556 for (const blink::WebMediaStreamTrack& web_track : web_tracks) { | 556 for (const blink::WebMediaStreamTrack& web_track : web_tracks) { |
| 557 MediaStreamTrack* track = MediaStreamTrack::GetTrack(web_track); | 557 MediaStreamAudioTrack* track = MediaStreamAudioTrack::GetTrack(web_track); |
| 558 // WebRtcAudioRenderer can only render audio tracks received from a remote | 558 // WebRtcAudioRenderer can only render audio tracks received from a remote |
| 559 // peer. Since the actual MediaStream is mutable from JavaScript, we need | 559 // peer. Since the actual MediaStream is mutable from JavaScript, we need |
| 560 // to make sure |web_track| is actually a remote track. | 560 // to make sure |web_track| is actually a remote track. |
| 561 if (track->is_local_track()) | 561 if (track->is_local_track()) |
| 562 continue; | 562 continue; |
| 563 webrtc::AudioSourceInterface* source = | 563 webrtc::AudioSourceInterface* source = |
| 564 track->GetAudioAdapter()->GetSource(); | 564 track->GetAudioAdapter()->GetSource(); |
| 565 DCHECK(source); | 565 DCHECK(source); |
| 566 if (!state->playing()) { | 566 if (!state->playing()) { |
| 567 if (RemovePlayingState(source, state)) | 567 if (RemovePlayingState(source, state)) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 sink_params_ = new_sink_params; | 648 sink_params_ = new_sink_params; |
| 649 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds; | 649 fifo_delay_milliseconds_ = new_fifo_delay_milliseconds; |
| 650 if (new_audio_fifo.get()) | 650 if (new_audio_fifo.get()) |
| 651 audio_fifo_ = new_audio_fifo.Pass(); | 651 audio_fifo_ = new_audio_fifo.Pass(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 sink_->Initialize(new_sink_params, this); | 654 sink_->Initialize(new_sink_params, this); |
| 655 } | 655 } |
| 656 | 656 |
| 657 } // namespace content | 657 } // namespace content |
| OLD | NEW |