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/mock_media_stream_dispatcher.h" | 5 #include "content/renderer/media/mock_media_stream_dispatcher.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "content/public/common/media_stream_request.h" | 8 #include "content/public/common/media_stream_request.h" |
9 #include "media/base/audio_parameters.h" | 9 #include "media/base/audio_parameters.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 void MockMediaStreamDispatcher::AddAudioInputDeviceToArray( | 84 void MockMediaStreamDispatcher::AddAudioInputDeviceToArray( |
85 bool matched_output, | 85 bool matched_output, |
86 const std::string& device_id) { | 86 const std::string& device_id) { |
87 StreamDeviceInfo audio; | 87 StreamDeviceInfo audio; |
88 audio.device.id = test_same_id_ ? "test_id" : device_id; | 88 audio.device.id = test_same_id_ ? "test_id" : device_id; |
89 audio.device.id = audio.device.id + base::IntToString(session_id_); | 89 audio.device.id = audio.device.id + base::IntToString(session_id_); |
90 audio.device.name = "microphone"; | 90 audio.device.name = "microphone"; |
91 audio.device.type = MEDIA_DEVICE_AUDIO_CAPTURE; | 91 audio.device.type = MEDIA_DEVICE_AUDIO_CAPTURE; |
92 audio.device.video_facing = MEDIA_VIDEO_FACING_NONE; | 92 audio.device.video_facing = media::MEDIA_VIDEO_FACING_NONE; |
93 if (matched_output) { | 93 if (matched_output) { |
94 audio.device.matched_output_device_id = | 94 audio.device.matched_output_device_id = |
95 kAudioOutputDeviceIdPrefix + base::IntToString(session_id_); | 95 kAudioOutputDeviceIdPrefix + base::IntToString(session_id_); |
96 } | 96 } |
97 audio.session_id = session_id_; | 97 audio.session_id = session_id_; |
98 audio.device.input.sample_rate = media::AudioParameters::kAudioCDSampleRate; | 98 audio.device.input.sample_rate = media::AudioParameters::kAudioCDSampleRate; |
99 audio.device.input.channel_layout = media::CHANNEL_LAYOUT_STEREO; | 99 audio.device.input.channel_layout = media::CHANNEL_LAYOUT_STEREO; |
100 audio.device.input.frames_per_buffer = audio.device.input.sample_rate / 100; | 100 audio.device.input.frames_per_buffer = audio.device.input.sample_rate / 100; |
101 audio_input_array_.push_back(audio); | 101 audio_input_array_.push_back(audio); |
102 } | 102 } |
103 | 103 |
104 void MockMediaStreamDispatcher::AddVideoDeviceToArray( | 104 void MockMediaStreamDispatcher::AddVideoDeviceToArray( |
105 bool facing_user, | 105 bool facing_user, |
106 const std::string& device_id) { | 106 const std::string& device_id) { |
107 StreamDeviceInfo video; | 107 StreamDeviceInfo video; |
108 video.device.id = test_same_id_ ? "test_id" : device_id; | 108 video.device.id = test_same_id_ ? "test_id" : device_id; |
109 video.device.id = video.device.id + base::IntToString(session_id_); | 109 video.device.id = video.device.id + base::IntToString(session_id_); |
110 video.device.name = "usb video camera"; | 110 video.device.name = "usb video camera"; |
111 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE; | 111 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE; |
112 video.device.video_facing = facing_user ? MEDIA_VIDEO_FACING_USER | 112 video.device.video_facing = facing_user |
113 : MEDIA_VIDEO_FACING_ENVIRONMENT; | 113 ? media::MEDIA_VIDEO_FACING_USER |
| 114 : media::MEDIA_VIDEO_FACING_ENVIRONMENT; |
114 video.session_id = session_id_; | 115 video.session_id = session_id_; |
115 video_array_.push_back(video); | 116 video_array_.push_back(video); |
116 } | 117 } |
117 | 118 |
118 } // namespace content | 119 } // namespace content |
OLD | NEW |