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 3 // found in the LICENSE file. 4 5 #include "content/common/media/media_stream_options.h" 6 7 #include "base/logging.h" 8 9 namespace content { 10 11 const char kMediaStreamSource[] = "chromeMediaSource"; 12 const char kMediaStreamSourceId[] = "chromeMediaSourceId"; 13 const char kMediaStreamSourceInfoId[] = "sourceId"; 14 const char kMediaStreamSourceTab[] = "tab"; 15 const char kMediaStreamSourceScreen[] = "screen"; 16 const char kMediaStreamSourceSystem[] = "system"; 17 18 StreamOptions::StreamOptions() 19 : audio_type(MEDIA_NO_SERVICE), 20 video_type(MEDIA_NO_SERVICE) {} 21 22 StreamOptions::StreamOptions(MediaStreamType audio_type, 23 MediaStreamType video_type) 24 : audio_type(audio_type), video_type(video_type) { 25 DCHECK(IsAudioMediaType(audio_type) || audio_type == MEDIA_NO_SERVICE); 26 DCHECK(IsVideoMediaType(video_type) || video_type == MEDIA_NO_SERVICE); 27 } 28 29 // static 30 const int StreamDeviceInfo::kNoId = -1; 31 32 StreamDeviceInfo::StreamDeviceInfo() 33 : in_use(false), 34 session_id(kNoId) {} 35 36 StreamDeviceInfo::StreamDeviceInfo(MediaStreamType service_param, 37 const std::string& name_param, 38 const std::string& device_param, 39 bool opened) 40 : device(service_param, device_param, name_param), 41 in_use(opened), 42 session_id(kNoId) { 43 } 44 45 StreamDeviceInfo::StreamDeviceInfo(MediaStreamType service_param, 46 const std::string& name_param, 47 const std::string& device_param, 48 int sample_rate, 49 int channel_layout, 50 bool opened) 51 : device(service_param, device_param, name_param, sample_rate, 52 channel_layout), 53 in_use(opened), 54 session_id(kNoId) { 55 } 56 57 // static 58 bool StreamDeviceInfo::IsEqual(const StreamDeviceInfo& first, 59 const StreamDeviceInfo& second) { 60 return first.device.type == second.device.type && 61 first.device.name == second.device.name && 62 first.device.id == second.device.id && 63 first.device.sample_rate == second.device.sample_rate && 64 first.device.channel_layout == second.device.channel_layout && 65 first.in_use == second.in_use && 66 first.session_id == second.session_id; 67 } 68 69 } // namespace content 70