diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 01:34:54 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 01:34:54 +0000 |
commit | ebdb2eca64c263b1b3eff023546d7e06e0432131 (patch) | |
tree | 742c398f65e106e13de37cef2822a1f0f6f3c51e /content/public/common/media_stream_request.h | |
parent | ffcf2f9b4acd11504a770dbb4efd5810f6387c1c (diff) | |
download | chromium_src-ebdb2eca64c263b1b3eff023546d7e06e0432131.zip chromium_src-ebdb2eca64c263b1b3eff023546d7e06e0432131.tar.gz chromium_src-ebdb2eca64c263b1b3eff023546d7e06e0432131.tar.bz2 |
StreamDeviceInfo is basically a MediaStreamDevice but with two extra variables, and we can remove lots of code by letting StreamDeviceInfo have a MediaStreamDevice as a member variable instead.
Also MediaStreamType is typedef of MediaStreamDeviceType, I remember the reason for doing it is simply using a shorter name for MediaStreamDeviceType. We can also merge them to make the code more readable.
BUG=137645
TEST=content_unittests
Review URL: https://chromiumcodereview.appspot.com/11530007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/common/media_stream_request.h')
-rw-r--r-- | content/public/common/media_stream_request.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/content/public/common/media_stream_request.h b/content/public/common/media_stream_request.h index 497a163..e50d4e9 100644 --- a/content/public/common/media_stream_request.h +++ b/content/public/common/media_stream_request.h @@ -16,7 +16,7 @@ namespace content { // Types of media streams. -enum MediaStreamDeviceType { +enum MediaStreamType { MEDIA_NO_SERVICE = 0, // A device provided by the operating system (e.g., webcam input). @@ -40,24 +40,26 @@ enum MediaStreamRequestType { // Convenience predicates to determine whether the given type represents some // audio or some video device. -CONTENT_EXPORT bool IsAudioMediaType(MediaStreamDeviceType type); -CONTENT_EXPORT bool IsVideoMediaType(MediaStreamDeviceType type); +CONTENT_EXPORT bool IsAudioMediaType(MediaStreamType type); +CONTENT_EXPORT bool IsVideoMediaType(MediaStreamType type); // TODO(xians): Change the structs to classes. // Represents one device in a request for media stream(s). struct CONTENT_EXPORT MediaStreamDevice { + MediaStreamDevice(); + MediaStreamDevice( - MediaStreamDeviceType type, - const std::string& device_id, + MediaStreamType type, + const std::string& id, const std::string& name); ~MediaStreamDevice(); // The device's type. - MediaStreamDeviceType type; + MediaStreamType type; // The device's unique ID. - std::string device_id; + std::string id; // The device's "friendly" name. Not guaranteed to be unique. std::string name; @@ -65,8 +67,7 @@ struct CONTENT_EXPORT MediaStreamDevice { typedef std::vector<MediaStreamDevice> MediaStreamDevices; -typedef std::map<MediaStreamDeviceType, MediaStreamDevices> - MediaStreamDeviceMap; +typedef std::map<MediaStreamType, MediaStreamDevices> MediaStreamDeviceMap; // Represents a request for media streams (audio/video). struct CONTENT_EXPORT MediaStreamRequest { @@ -75,8 +76,8 @@ struct CONTENT_EXPORT MediaStreamRequest { int render_view_id, const GURL& security_origin, MediaStreamRequestType request_type, - MediaStreamDeviceType audio_type, - MediaStreamDeviceType video_type); + MediaStreamType audio_type, + MediaStreamType video_type); ~MediaStreamRequest(); @@ -96,10 +97,10 @@ struct CONTENT_EXPORT MediaStreamRequest { MediaStreamRequestType request_type; // Flag to indicate if the request contains audio. - MediaStreamDeviceType audio_type; + MediaStreamType audio_type; // Flag to indicate if the request contains video. - MediaStreamDeviceType video_type; + MediaStreamType video_type; }; } // namespace content |