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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 594 } |
595 | 595 |
596 void WebRtcAudioRenderer::OnPlayStateChanged( | 596 void WebRtcAudioRenderer::OnPlayStateChanged( |
597 const blink::WebMediaStream& media_stream, | 597 const blink::WebMediaStream& media_stream, |
598 PlayingState* state) { | 598 PlayingState* state) { |
599 DCHECK(thread_checker_.CalledOnValidThread()); | 599 DCHECK(thread_checker_.CalledOnValidThread()); |
600 blink::WebVector<blink::WebMediaStreamTrack> web_tracks; | 600 blink::WebVector<blink::WebMediaStreamTrack> web_tracks; |
601 media_stream.audioTracks(web_tracks); | 601 media_stream.audioTracks(web_tracks); |
602 | 602 |
603 for (const blink::WebMediaStreamTrack& web_track : web_tracks) { | 603 for (const blink::WebMediaStreamTrack& web_track : web_tracks) { |
604 MediaStreamAudioTrack* track = MediaStreamAudioTrack::GetTrack(web_track); | 604 MediaStreamAudioTrack* track = MediaStreamAudioTrack::From(web_track); |
605 // WebRtcAudioRenderer can only render audio tracks received from a remote | 605 // WebRtcAudioRenderer can only render audio tracks received from a remote |
606 // peer. Since the actual MediaStream is mutable from JavaScript, we need | 606 // peer. Since the actual MediaStream is mutable from JavaScript, we need |
607 // to make sure |web_track| is actually a remote track. | 607 // to make sure |web_track| is actually a remote track. |
608 if (track->is_local_track()) | 608 if (track->is_local_track()) |
609 continue; | 609 continue; |
610 webrtc::AudioSourceInterface* source = | 610 webrtc::AudioSourceInterface* source = |
611 track->GetAudioAdapter()->GetSource(); | 611 track->GetAudioAdapter()->GetSource(); |
612 DCHECK(source); | 612 DCHECK(source); |
613 if (!state->playing()) { | 613 if (!state->playing()) { |
614 if (RemovePlayingState(source, state)) | 614 if (RemovePlayingState(source, state)) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 base::Bind(&WebRtcAudioRenderer::SourceCallback, | 680 base::Bind(&WebRtcAudioRenderer::SourceCallback, |
681 base::Unretained(this)))); | 681 base::Unretained(this)))); |
682 } | 682 } |
683 sink_params_ = new_sink_params; | 683 sink_params_ = new_sink_params; |
684 } | 684 } |
685 | 685 |
686 sink_->Initialize(new_sink_params, this); | 686 sink_->Initialize(new_sink_params, this); |
687 } | 687 } |
688 | 688 |
689 } // namespace content | 689 } // namespace content |
OLD | NEW |