Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: content/public/common/media_stream_request.cc

Issue 11783059: Ensures that WebRTC works for device selection using a different sample rate than default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed content_unittests Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/public/common/media_stream_request.h" 5 #include "content/public/common/media_stream_request.h"
6 6
7 #include "base/logging.h"
8
7 namespace content { 9 namespace content {
8 10
9 bool IsAudioMediaType(MediaStreamType type) { 11 bool IsAudioMediaType(MediaStreamType type) {
10 return (type == content::MEDIA_DEVICE_AUDIO_CAPTURE || 12 return (type == content::MEDIA_DEVICE_AUDIO_CAPTURE ||
11 type == content::MEDIA_TAB_AUDIO_CAPTURE); 13 type == content::MEDIA_TAB_AUDIO_CAPTURE);
12 } 14 }
13 15
14 bool IsVideoMediaType(MediaStreamType type) { 16 bool IsVideoMediaType(MediaStreamType type) {
15 return (type == content::MEDIA_DEVICE_VIDEO_CAPTURE || 17 return (type == content::MEDIA_DEVICE_VIDEO_CAPTURE ||
16 type == content::MEDIA_TAB_VIDEO_CAPTURE); 18 type == content::MEDIA_TAB_VIDEO_CAPTURE);
17 } 19 }
18 20
19 MediaStreamDevice::MediaStreamDevice() : type(MEDIA_NO_SERVICE) {} 21 MediaStreamDevice::MediaStreamDevice() : type(MEDIA_NO_SERVICE) {}
20 22
21 MediaStreamDevice::MediaStreamDevice( 23 MediaStreamDevice::MediaStreamDevice(
22 MediaStreamType type, 24 MediaStreamType type,
23 const std::string& id, 25 const std::string& id,
24 const std::string& name) 26 const std::string& name)
25 : type(type), 27 : type(type),
26 id(id), 28 id(id),
27 name(name) { 29 name(name),
30 sample_rate(0),
31 channel_layout(0) {
32 DCHECK(IsVideoMediaType(type));
33 }
34
35 MediaStreamDevice::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 DCHECK(IsAudioMediaType(type));
tommi (sloooow) - chröme 2013/01/15 17:43:49 these dchecks are a nice touch.
henrika (OOO until Aug 14) 2013/01/16 16:37:17 I know ;-)
28 } 47 }
29 48
30 MediaStreamDevice::~MediaStreamDevice() {} 49 MediaStreamDevice::~MediaStreamDevice() {}
31 50
32 MediaStreamRequest::MediaStreamRequest( 51 MediaStreamRequest::MediaStreamRequest(
33 int render_process_id, 52 int render_process_id,
34 int render_view_id, 53 int render_view_id,
35 const GURL& security_origin, 54 const GURL& security_origin,
36 MediaStreamRequestType request_type, 55 MediaStreamRequestType request_type,
37 MediaStreamType audio_type, 56 MediaStreamType audio_type,
38 MediaStreamType video_type) 57 MediaStreamType video_type)
39 : render_process_id(render_process_id), 58 : render_process_id(render_process_id),
40 render_view_id(render_view_id), 59 render_view_id(render_view_id),
41 security_origin(security_origin), 60 security_origin(security_origin),
42 request_type(request_type), 61 request_type(request_type),
43 audio_type(audio_type), 62 audio_type(audio_type),
44 video_type(video_type) { 63 video_type(video_type) {
45 } 64 }
46 65
47 MediaStreamRequest::~MediaStreamRequest() {} 66 MediaStreamRequest::~MediaStreamRequest() {}
48 67
49 } // namespace content 68 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698