diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-18 10:30:24 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-18 10:30:24 +0000 |
commit | f08fa69ca6ada8dfbd10f78029d81f0a32de5a55 (patch) | |
tree | d0dedc62aca026b833e5e9deb3a196ecb0667839 /chrome/renderer/media | |
parent | 6ce837cc5935728fa8d506aa1ef502ae758ac745 (diff) | |
download | chromium_src-f08fa69ca6ada8dfbd10f78029d81f0a32de5a55.zip chromium_src-f08fa69ca6ada8dfbd10f78029d81f0a32de5a55.tar.gz chromium_src-f08fa69ca6ada8dfbd10f78029d81f0a32de5a55.tar.bz2 |
Interface and skeleton code for Cast Extensions API
Adding the following classes that make up the Cast Extensions API:
1. CastSendTransport
Allows configuration of RTP and encoding of streams. Takes
video/audio streams and connect to network transport.
2. CastUdpTransport
Interface for a UDP transport in Cast. This is used by
CastSendTransport to connect to a peer.
3. CastSession
A hub of objects that make up the Cast services. Submits actual
video and audio data to CastSender, which performs encoding and
packetization. It takes the packetized data to a network transport.
BUG=301920
Review URL: https://codereview.chromium.org/27435002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/media')
-rw-r--r-- | chrome/renderer/media/cast_send_transport.cc | 66 | ||||
-rw-r--r-- | chrome/renderer/media/cast_send_transport.h | 109 | ||||
-rw-r--r-- | chrome/renderer/media/cast_session.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/media/cast_session.h | 27 | ||||
-rw-r--r-- | chrome/renderer/media/cast_udp_transport.cc | 21 | ||||
-rw-r--r-- | chrome/renderer/media/cast_udp_transport.h | 30 |
6 files changed, 264 insertions, 0 deletions
diff --git a/chrome/renderer/media/cast_send_transport.cc b/chrome/renderer/media/cast_send_transport.cc new file mode 100644 index 0000000..f2889df --- /dev/null +++ b/chrome/renderer/media/cast_send_transport.cc @@ -0,0 +1,66 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/media/cast_send_transport.h" + +#include "base/logging.h" + +CastCodecSpecificParam::CastCodecSpecificParam() { +} + +CastCodecSpecificParam::~CastCodecSpecificParam() { +} + +CastRtpPayloadParam::CastRtpPayloadParam() + : payload_type(0), + ssrc(0), + clock_rate(0), + bitrate(0), + channels(0), + width(0), + height(0) { +} + +CastRtpPayloadParam::~CastRtpPayloadParam() { +} + +CastRtpCaps::CastRtpCaps() { +} + +CastRtpCaps::~CastRtpCaps() { +} + +CastSendTransport::CastSendTransport( + CastUdpTransport* udp_transport) { + NOTIMPLEMENTED(); +} + +CastSendTransport::~CastSendTransport() { +} + +CastRtpCaps CastSendTransport::GetCaps() { + NOTIMPLEMENTED(); + return CastRtpCaps(); +} + +CastRtpParams CastSendTransport::GetParams() { + NOTIMPLEMENTED(); + return CastRtpParams(); +} + +CastRtpParams CastSendTransport::CreateParams( + CastRtpCaps remote_caps) { + NOTIMPLEMENTED(); + return CastRtpParams(); +} + +void CastSendTransport::Start(WebKit::WebMediaStreamTrack* audio_track, + WebKit::WebMediaStreamTrack* video_track, + CastRtpParams params) { + NOTIMPLEMENTED(); +} + +void CastSendTransport::Stop() { + NOTIMPLEMENTED(); +} diff --git a/chrome/renderer/media/cast_send_transport.h b/chrome/renderer/media/cast_send_transport.h new file mode 100644 index 0000000..235d7ab --- /dev/null +++ b/chrome/renderer/media/cast_send_transport.h @@ -0,0 +1,109 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_MEDIA_CAST_SEND_TRANSPORT_H_ +#define CHROME_RENDERER_MEDIA_CAST_SEND_TRANSPORT_H_ + +#include <string> +#include <vector> + +#include "base/basictypes.h" + +namespace WebKit { +class WebMediaStreamTrack; +} // namespace WebKit + +class CastUdpTransport; + +// A key value pair structure for codec specific parameters. +struct CastCodecSpecificParam { + std::string key; + std::string value; + + CastCodecSpecificParam(); + ~CastCodecSpecificParam(); +}; + +// Defines the basic properties of a payload supported by cast transport. +struct CastRtpPayloadParam { + // RTP specific field that identifies the content type. + int payload_type; + + // RTP specific field to identify a stream. + int ssrc; + + // Update frequency of payload sample. + int clock_rate; + + // Uncompressed bitrate. + int bitrate; + + // Number of audio channels. + int channels; + + // Width and height of the video content. + int width; + int height; + + // Name of the codec used. + std::string codec_name; + + // List of codec specific parameters. + std::vector<CastCodecSpecificParam> codec_specific_params; + + CastRtpPayloadParam(); + ~CastRtpPayloadParam(); +}; + +// Defines the capabilities of the transport. +struct CastRtpCaps { + // Defines a list of supported payloads. + std::vector<CastRtpPayloadParam> payloads; + + // Names of supported RTCP features. + std::vector<std::string> rtcp_features; + + // Names of supported FEC (Forward Error Correction) mechanisms. + std::vector<std::string> fec_mechanism; + + CastRtpCaps(); + ~CastRtpCaps(); +}; + +typedef CastRtpCaps CastRtpParams; + +// This class takes input from audio and/or video WebMediaStreamTracks +// and then send the encoded streams to the underlying transport, +// e.g. a UDP transport. It also allows configuration of the encoded +// stream. +class CastSendTransport { + public: + explicit CastSendTransport(CastUdpTransport* udp_transport); + ~CastSendTransport(); + + // Return capabilities currently spported by this transport. + CastRtpCaps GetCaps(); + + // Return parameters set to this transport. + CastRtpParams GetParams(); + + // Return the best parameters given the capabilities of remote peer. + CastRtpParams CreateParams(CastRtpCaps remote_caps); + + // Begin encoding of media stream from |audio_track| and |video_track| + // and then submit the encoded streams to underlying transport. + // Either stream can be NULL but it is invalid for both streams to be + // NULL. + void Start(WebKit::WebMediaStreamTrack* audio_track, + WebKit::WebMediaStreamTrack* video_track, + CastRtpParams params); + + // Stop encoding. + void Stop(); + + private: + DISALLOW_COPY_AND_ASSIGN(CastSendTransport); +}; + +#endif // CHROME_RENDERER_MEDIA_CAST_SEND_TRANSPORT_H_ diff --git a/chrome/renderer/media/cast_session.cc b/chrome/renderer/media/cast_session.cc new file mode 100644 index 0000000..530f6a0 --- /dev/null +++ b/chrome/renderer/media/cast_session.cc @@ -0,0 +1,11 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/media/cast_session.h" + +CastSession::CastSession() { +} + +CastSession::~CastSession() { +} diff --git a/chrome/renderer/media/cast_session.h b/chrome/renderer/media/cast_session.h new file mode 100644 index 0000000..5e39c83 --- /dev/null +++ b/chrome/renderer/media/cast_session.h @@ -0,0 +1,27 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_MEDIA_CAST_SESSION_H_ +#define CHROME_RENDERER_MEDIA_CAST_SESSION_H_ + +#include "base/basictypes.h" + +// This class represents a Cast session which consists of the +// following three major components: +// 1. Video and audio input. +// 2. Cast RTP transport. +// 3. Network connection. +// +// This class connects the above three components to provide a Cast +// service. +class CastSession { + public: + CastSession(); + ~CastSession(); + + private: + DISALLOW_COPY_AND_ASSIGN(CastSession); +}; + +#endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ diff --git a/chrome/renderer/media/cast_udp_transport.cc b/chrome/renderer/media/cast_udp_transport.cc new file mode 100644 index 0000000..3c864c9 --- /dev/null +++ b/chrome/renderer/media/cast_udp_transport.cc @@ -0,0 +1,21 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/media/cast_udp_transport.h" + +#include "base/logging.h" + +CastUdpTransport::CastUdpTransport() { +} + +CastUdpTransport::~CastUdpTransport() { +} + +void CastUdpTransport::Start(const net::IPEndPoint& remote_address) { + NOTIMPLEMENTED(); +} + +void CastUdpTransport::Stop() { + NOTIMPLEMENTED(); +} diff --git a/chrome/renderer/media/cast_udp_transport.h b/chrome/renderer/media/cast_udp_transport.h new file mode 100644 index 0000000..e2e5c28 --- /dev/null +++ b/chrome/renderer/media/cast_udp_transport.h @@ -0,0 +1,30 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_MEDIA_CAST_UDP_TRANSPORT_H_ +#define CHROME_RENDERER_MEDIA_CAST_UDP_TRANSPORT_H_ + +#include "base/basictypes.h" +#include "net/base/ip_endpoint.h" + +// This class represents an end point to which communication is done by +// UDP. The interface does not allow direct access to a UDP socket but +// represents a transport mechanism. +class CastUdpTransport { + public: + CastUdpTransport(); + ~CastUdpTransport(); + + // Begin the transport by specifying the remote IP address. + // The transport will use UDP. + void Start(const net::IPEndPoint& remote_address); + + // Terminate the communication with the end point. + void Stop(); + + private: + DISALLOW_COPY_AND_ASSIGN(CastUdpTransport); +}; + +#endif // CHROME_RENDERER_MEDIA_CAST_UDP_TRANSPORT_H_ |