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_local_audio_track_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
6 #include "content/renderer/media/webrtc_local_audio_track.h" | 6 #include "content/renderer/media/webrtc_local_audio_track.h" |
7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 : params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 34 : params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
35 media::CHANNEL_LAYOUT_STEREO, 48000, 16, 480), | 35 media::CHANNEL_LAYOUT_STEREO, 48000, 16, 480), |
36 adapter_(WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)), | 36 adapter_(WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)), |
37 capturer_(WebRtcAudioCapturer::CreateCapturer( | 37 capturer_(WebRtcAudioCapturer::CreateCapturer( |
38 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""), | 38 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""), |
39 blink::WebMediaConstraints(), NULL)), | 39 blink::WebMediaConstraints(), NULL)), |
40 track_(new WebRtcLocalAudioTrack(adapter_, capturer_, NULL)) {} | 40 track_(new WebRtcLocalAudioTrack(adapter_, capturer_, NULL)) {} |
41 | 41 |
42 protected: | 42 protected: |
43 virtual void SetUp() OVERRIDE { | 43 virtual void SetUp() OVERRIDE { |
44 static_cast<WebRtcLocalAudioSourceProvider*>( | |
45 track_->audio_source_provider())->SetSinkParamsForTesting(params_); | |
46 track_->OnSetFormat(params_); | 44 track_->OnSetFormat(params_); |
47 EXPECT_TRUE(track_->GetAudioAdapter()->enabled()); | 45 EXPECT_TRUE(track_->GetAudioAdapter()->enabled()); |
48 } | 46 } |
49 | 47 |
50 media::AudioParameters params_; | 48 media::AudioParameters params_; |
51 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_; | 49 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_; |
52 scoped_refptr<WebRtcAudioCapturer> capturer_; | 50 scoped_refptr<WebRtcAudioCapturer> capturer_; |
53 scoped_ptr<WebRtcLocalAudioTrack> track_; | 51 scoped_ptr<WebRtcLocalAudioTrack> track_; |
54 }; | 52 }; |
55 | 53 |
(...skipping 19 matching lines...) Expand all Loading... |
75 | 73 |
76 // Remove the sink from the webrtc track. | 74 // Remove the sink from the webrtc track. |
77 webrtc_track->RemoveSink(sink.get()); | 75 webrtc_track->RemoveSink(sink.get()); |
78 sink.reset(); | 76 sink.reset(); |
79 | 77 |
80 // Verify that no more callback gets into the sink. | 78 // Verify that no more callback gets into the sink. |
81 track_->Capture(data.get(), base::TimeDelta(), 255, false, false); | 79 track_->Capture(data.get(), base::TimeDelta(), 255, false, false); |
82 } | 80 } |
83 | 81 |
84 } // namespace content | 82 } // namespace content |
OLD | NEW |