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 content { |
10 | 10 |
11 const char kMediaStreamSource[] = "chromeMediaSource"; | 11 const char kMediaStreamSource[] = "chromeMediaSource"; |
12 const char kMediaStreamSourceId[] = "chromeMediaSourceId"; | 12 const char kMediaStreamSourceId[] = "chromeMediaSourceId"; |
13 const char kMediaStreamSourceTab[] = "tab"; | 13 const char kMediaStreamSourceTab[] = "tab"; |
14 | 14 |
15 StreamOptions::StreamOptions() | 15 StreamOptions::StreamOptions() |
16 : audio_type(content::MEDIA_NO_SERVICE), | 16 : audio_type(MEDIA_NO_SERVICE), |
17 video_type(content::MEDIA_NO_SERVICE) {} | 17 video_type(MEDIA_NO_SERVICE) {} |
18 | 18 |
19 StreamOptions::StreamOptions(MediaStreamType audio_type, | 19 StreamOptions::StreamOptions(MediaStreamType audio_type, |
20 MediaStreamType video_type) | 20 MediaStreamType video_type) |
21 : audio_type(audio_type), video_type(video_type) { | 21 : audio_type(audio_type), video_type(video_type) { |
22 DCHECK(IsAudioMediaType(audio_type) || | 22 DCHECK(IsAudioMediaType(audio_type) || audio_type == MEDIA_NO_SERVICE); |
23 audio_type == content::MEDIA_NO_SERVICE); | 23 DCHECK(IsVideoMediaType(video_type) || video_type == MEDIA_NO_SERVICE); |
24 DCHECK(IsVideoMediaType(video_type) || | |
25 video_type == content::MEDIA_NO_SERVICE); | |
26 } | 24 } |
27 | 25 |
28 // static | 26 // static |
29 const int StreamDeviceInfo::kNoId = -1; | 27 const int StreamDeviceInfo::kNoId = -1; |
30 | 28 |
31 StreamDeviceInfo::StreamDeviceInfo() | 29 StreamDeviceInfo::StreamDeviceInfo() |
32 : stream_type(content::MEDIA_NO_SERVICE), | 30 : stream_type(MEDIA_NO_SERVICE), |
33 in_use(false), | 31 in_use(false), |
34 session_id(kNoId) {} | 32 session_id(kNoId) {} |
35 | 33 |
36 StreamDeviceInfo::StreamDeviceInfo(MediaStreamType service_param, | 34 StreamDeviceInfo::StreamDeviceInfo(MediaStreamType service_param, |
37 const std::string& name_param, | 35 const std::string& name_param, |
38 const std::string& device_param, | 36 const std::string& device_param, |
39 bool opened) | 37 bool opened) |
40 : stream_type(service_param), | 38 : stream_type(service_param), |
41 name(name_param), | 39 name(name_param), |
42 device_id(device_param), | 40 device_id(device_param), |
43 in_use(opened), | 41 in_use(opened), |
44 session_id(kNoId) {} | 42 session_id(kNoId) {} |
45 | 43 |
46 // static | 44 // static |
47 bool StreamDeviceInfo::IsEqual(const StreamDeviceInfo& first, | 45 bool StreamDeviceInfo::IsEqual(const StreamDeviceInfo& first, |
48 const StreamDeviceInfo& second) { | 46 const StreamDeviceInfo& second) { |
49 return first.stream_type == second.stream_type && | 47 return first.stream_type == second.stream_type && |
50 first.name == second.name && | 48 first.name == second.name && |
51 first.device_id == second.device_id && | 49 first.device_id == second.device_id && |
52 first.in_use == second.in_use && | 50 first.in_use == second.in_use && |
53 first.session_id == second.session_id; | 51 first.session_id == second.session_id; |
54 } | 52 } |
55 | 53 |
56 } // namespace media_stream | 54 } // namespace content |
OLD | NEW |