Chromium Code Reviews| 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/common/media/media_stream_options.h" | 5 #include "content/common/media/media_stream_options.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace media_stream { | 9 namespace media_stream { |
| 10 | 10 |
| 11 const char kMediaStreamSource[] = "chromeMediaSource"; | |
| 12 const char kMediaStreamSourceId[] = "chromeMediaSourceId"; | |
| 13 const char kMediaStreamSourceTab[] = "tab"; | |
| 14 | |
| 11 StreamOptions::StreamOptions() | 15 StreamOptions::StreamOptions() |
| 12 : audio_type(content::MEDIA_NO_SERVICE), | 16 : audio_type(content::MEDIA_NO_SERVICE), |
| 13 video_type(content::MEDIA_NO_SERVICE) {} | 17 video_type(content::MEDIA_NO_SERVICE) {} |
| 14 | 18 |
| 15 StreamOptions::StreamOptions(bool user_audio, bool user_video) | 19 StreamOptions::StreamOptions(bool user_audio, bool user_video) |
| 16 : audio_type(user_audio ? | 20 : audio_type(user_audio ? |
| 17 content::MEDIA_DEVICE_AUDIO_CAPTURE : | 21 content::MEDIA_DEVICE_AUDIO_CAPTURE : |
| 18 content::MEDIA_NO_SERVICE), | 22 content::MEDIA_NO_SERVICE), |
| 19 video_type(user_video ? | 23 video_type(user_video ? |
| 20 content::MEDIA_DEVICE_VIDEO_CAPTURE : | 24 content::MEDIA_DEVICE_VIDEO_CAPTURE : |
| 21 content::MEDIA_NO_SERVICE) {} | 25 content::MEDIA_NO_SERVICE) {} |
| 22 | 26 |
| 23 StreamOptions::StreamOptions(MediaStreamType audio_type, | 27 StreamOptions::StreamOptions(MediaStreamType audio_type, |
| 24 MediaStreamType video_type) | 28 MediaStreamType video_type) |
| 25 : audio_type(audio_type), video_type(video_type) { | 29 : audio_type(audio_type), video_type(video_type) { |
| 26 DCHECK(IsAudioMediaType(audio_type) || | 30 DCHECK(IsAudioMediaType(audio_type) || |
| 27 audio_type == content::MEDIA_NO_SERVICE); | 31 audio_type == content::MEDIA_NO_SERVICE); |
| 28 DCHECK(IsVideoMediaType(video_type) || | 32 DCHECK(IsVideoMediaType(video_type) || |
| 29 video_type == content::MEDIA_NO_SERVICE); | 33 video_type == content::MEDIA_NO_SERVICE); |
| 30 } | 34 } |
| 31 | 35 |
| 36 StreamOptions::StreamOptions(MediaStreamType audio_type, | |
|
perkj_chrome
2012/10/12 13:22:05
Can you remove the other constructor?
justinlin
2012/10/12 20:04:20
Done.
| |
| 37 std::string audio_device_id, | |
| 38 MediaStreamType video_type, | |
| 39 std::string video_device_id) | |
| 40 : audio_type(audio_type), | |
| 41 audio_device_id(audio_device_id), | |
| 42 video_type(video_type), | |
| 43 video_device_id(video_device_id) { | |
| 44 DCHECK(IsAudioMediaType(audio_type) || | |
| 45 audio_type == content::MEDIA_NO_SERVICE); | |
| 46 DCHECK(!audio_device_id.empty()); | |
| 47 DCHECK(IsVideoMediaType(video_type) || | |
| 48 video_type == content::MEDIA_NO_SERVICE); | |
| 49 DCHECK(!video_device_id.empty()); | |
|
perkj_chrome
2012/10/12 13:22:05
Isn't this empty in normal case.
justinlin
2012/10/12 20:04:20
Done.
| |
| 50 } | |
| 51 | |
| 32 // static | 52 // static |
| 33 const int StreamDeviceInfo::kNoId = -1; | 53 const int StreamDeviceInfo::kNoId = -1; |
| 34 | 54 |
| 35 StreamDeviceInfo::StreamDeviceInfo() | 55 StreamDeviceInfo::StreamDeviceInfo() |
| 36 : stream_type(content::MEDIA_NO_SERVICE), | 56 : stream_type(content::MEDIA_NO_SERVICE), |
| 37 in_use(false), | 57 in_use(false), |
| 38 session_id(kNoId) {} | 58 session_id(kNoId) {} |
| 39 | 59 |
| 40 StreamDeviceInfo::StreamDeviceInfo(MediaStreamType service_param, | 60 StreamDeviceInfo::StreamDeviceInfo(MediaStreamType service_param, |
| 41 const std::string& name_param, | 61 const std::string& name_param, |
| 42 const std::string& device_param, | 62 const std::string& device_param, |
| 43 bool opened) | 63 bool opened) |
| 44 : stream_type(service_param), | 64 : stream_type(service_param), |
| 45 name(name_param), | 65 name(name_param), |
| 46 device_id(device_param), | 66 device_id(device_param), |
| 47 in_use(opened), | 67 in_use(opened), |
| 48 session_id(kNoId) {} | 68 session_id(kNoId) {} |
| 49 | 69 |
| 50 // static | 70 // static |
| 51 bool StreamDeviceInfo::IsEqual(const StreamDeviceInfo& first, | 71 bool StreamDeviceInfo::IsEqual(const StreamDeviceInfo& first, |
| 52 const StreamDeviceInfo& second) { | 72 const StreamDeviceInfo& second) { |
| 53 return first.stream_type == second.stream_type && | 73 return first.stream_type == second.stream_type && |
| 54 first.name == second.name && | 74 first.name == second.name && |
| 55 first.device_id == second.device_id && | 75 first.device_id == second.device_id && |
| 56 first.in_use == second.in_use && | 76 first.in_use == second.in_use && |
| 57 first.session_id == second.session_id; | 77 first.session_id == second.session_id; |
| 58 } | 78 } |
| 59 | 79 |
| 60 } // namespace media_stream | 80 } // namespace media_stream |
| OLD | NEW |