| 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_audio_track.h" | 5 #include "content/renderer/media/media_stream_audio_track.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 9 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 10 #include "third_party/webrtc/api/mediastreaminterface.h" | 10 #include "third_party/webrtc/api/mediastreaminterface.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 << "BUG: Subclass must ensure Stop() is called."; | 24 << "BUG: Subclass must ensure Stop() is called."; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 MediaStreamAudioTrack* MediaStreamAudioTrack::From( | 28 MediaStreamAudioTrack* MediaStreamAudioTrack::From( |
| 29 const blink::WebMediaStreamTrack& track) { | 29 const blink::WebMediaStreamTrack& track) { |
| 30 if (track.isNull() || | 30 if (track.isNull() || |
| 31 track.source().getType() != blink::WebMediaStreamSource::TypeAudio) { | 31 track.source().getType() != blink::WebMediaStreamSource::TypeAudio) { |
| 32 return nullptr; | 32 return nullptr; |
| 33 } | 33 } |
| 34 return static_cast<MediaStreamAudioTrack*>(track.extraData()); | 34 return static_cast<MediaStreamAudioTrack*>(track.getExtraData()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void MediaStreamAudioTrack::Start(const base::Closure& stop_callback) { | 37 void MediaStreamAudioTrack::Start(const base::Closure& stop_callback) { |
| 38 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 38 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 39 DCHECK(!stop_callback.is_null()); | 39 DCHECK(!stop_callback.is_null()); |
| 40 DCHECK(stop_callback_.is_null()); | 40 DCHECK(stop_callback_.is_null()); |
| 41 DVLOG(1) << "MediaStreamAudioTrack::Start()"; | 41 DVLOG(1) << "MediaStreamAudioTrack::Start()"; |
| 42 stop_callback_ = stop_callback; | 42 stop_callback_ = stop_callback; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void MediaStreamAudioTrack::Stop() { | 45 void MediaStreamAudioTrack::Stop() { |
| 46 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 46 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 47 DVLOG(1) << "MediaStreamAudioTrack::Stop()"; | 47 DVLOG(1) << "MediaStreamAudioTrack::Stop()"; |
| 48 if (!stop_callback_.is_null()) | 48 if (!stop_callback_.is_null()) |
| 49 base::ResetAndReturn(&stop_callback_).Run(); | 49 base::ResetAndReturn(&stop_callback_).Run(); |
| 50 OnStop(); | 50 OnStop(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void MediaStreamAudioTrack::OnStop() {} | 53 void MediaStreamAudioTrack::OnStop() {} |
| 54 | 54 |
| 55 webrtc::AudioTrackInterface* MediaStreamAudioTrack::GetAudioAdapter() { | 55 webrtc::AudioTrackInterface* MediaStreamAudioTrack::GetAudioAdapter() { |
| 56 NOTREACHED(); | 56 NOTREACHED(); |
| 57 return nullptr; | 57 return nullptr; |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace content | 60 } // namespace content |
| OLD | NEW |