media_stream_request.cc revision 7dbb3d5cf0c15f500944d211057644d6a2f37371
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/public/common/media_stream_request.h"
6
7#include "base/logging.h"
8
9namespace content {
10
11bool IsAudioMediaType(MediaStreamType type) {
12  return (type == content::MEDIA_DEVICE_AUDIO_CAPTURE ||
13          type == content::MEDIA_TAB_AUDIO_CAPTURE);
14}
15
16bool IsVideoMediaType(MediaStreamType type) {
17  return (type == content::MEDIA_DEVICE_VIDEO_CAPTURE ||
18          type == content::MEDIA_TAB_VIDEO_CAPTURE ||
19          type == content::MEDIA_SCREEN_VIDEO_CAPTURE);
20}
21
22MediaStreamDevice::MediaStreamDevice() : type(MEDIA_NO_SERVICE) {}
23
24MediaStreamDevice::MediaStreamDevice(
25    MediaStreamType type,
26    const std::string& id,
27    const std::string& name)
28    : type(type),
29      id(id),
30      name(name),
31      sample_rate(0),
32      channel_layout(0) {
33}
34
35MediaStreamDevice::MediaStreamDevice(
36    MediaStreamType type,
37    const std::string& id,
38    const std::string& name,
39    int sample_rate,
40    int channel_layout)
41    : type(type),
42      id(id),
43      name(name),
44      sample_rate(sample_rate),
45      channel_layout(channel_layout) {
46}
47
48MediaStreamDevice::~MediaStreamDevice() {}
49
50MediaStreamRequest::MediaStreamRequest(
51    int render_process_id,
52    int render_view_id,
53    int page_request_id,
54    const std::string& tab_capture_device_id,
55    const GURL& security_origin,
56    MediaStreamRequestType request_type,
57    const std::string& requested_audio_device_id,
58    const std::string& requested_video_device_id,
59    MediaStreamType audio_type,
60    MediaStreamType video_type)
61    : render_process_id(render_process_id),
62      render_view_id(render_view_id),
63      page_request_id(page_request_id),
64      tab_capture_device_id(tab_capture_device_id),
65      security_origin(security_origin),
66      request_type(request_type),
67      requested_audio_device_id(requested_audio_device_id),
68      requested_video_device_id(requested_video_device_id),
69      audio_type(audio_type),
70      video_type(video_type) {
71}
72
73MediaStreamRequest::~MediaStreamRequest() {}
74
75}  // namespace content
76