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

Unified Diff: content/public/renderer/webrtc_cast_send_transport.h

Issue 26931002: Define Cast Content API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revised API and comments Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/public/renderer/webrtc_cast_send_transport.h
diff --git a/content/public/renderer/webrtc_cast_send_transport.h b/content/public/renderer/webrtc_cast_send_transport.h
new file mode 100644
index 0000000000000000000000000000000000000000..0198debe9e2bbb960c5ecd90d0c9acb5b20b067f
--- /dev/null
+++ b/content/public/renderer/webrtc_cast_send_transport.h
@@ -0,0 +1,111 @@
+// 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 CONTENT_PUBLIC_RENDERER_MEDIA_WEBRTC_CAST_SEND_TRANSPORT_H_
jam 2013/10/11 16:47:14 nit: get rid of _MEDIA_
Alpha Left Google 2013/10/11 20:24:21 Done.
+#define CONTENT_PUBLIC_RENDERER_MEDIA_WEBRTC_CAST_SEND_TRANSPORT_H_
+
+#include <string>
+#include <vector>
+
+#include "base/callback.h"
jam 2013/10/11 16:47:14 nit: not needed
Alpha Left Google 2013/10/11 20:24:21 Done.
+#include "content/common/content_export.h"
+
+namespace WebKit {
+class WebMediaStreamTrack;
+} // namespace WebKit
+
+namespace content {
+
+class WebRtcUdpTransport;
+
+// A key value pair structure for codec specific parameters.
+struct CONTENT_EXPORT WebRtcCodecSpecificParam {
jam 2013/10/11 16:47:14 this isn't used?
Alpha Left Google 2013/10/11 20:24:21 Thanks. I forgot to use this WebRtcRtpPayloadParam
+ std::string key;
+ std::string value;
+
+ WebRtcCodecSpecificParam();
+ ~WebRtcCodecSpecificParam();
+};
+
+// Defines the basic properties of a payload supported by cast transport.
+struct CONTENT_EXPORT WebRtcRtpPayloadParam {
+ // 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;
+
+ WebRtcRtpPayloadParam();
jam 2013/10/11 16:47:14 can you inline this without getting a clang error?
Alpha Left Google 2013/10/11 20:24:21 I tried but clang complained that I should put the
+ ~WebRtcRtpPayloadParam();
+};
+
+// Defines the capabilities of the transport.
+struct CONTENT_EXPORT WebRtcRtpCaps {
+ // Defines a list of supported payloads.
+ std::vector<WebRtcRtpPayloadParam> 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;
+
+ WebRtcRtpCaps();
+ ~WebRtcRtpCaps();
+};
+
+typedef WebRtcRtpCaps WebRtcRtpParams;
+
+// This interface defines operations needed by an application to use the
+// Cast transport protocol and interact with WebRTC objects.
+// This interface takes input from a WebMediaStreamTrack which contains
+// audio or video stream and then send the encoded stream to the
+// underlying transport, e.g. a UDP transport.
+class CONTENT_EXPORT WebRtcCastSendTransport {
jam 2013/10/11 16:47:14 nit: export not needed
Alpha Left Google 2013/10/11 20:24:21 Done.
+ public:
+ // Return capabilities currently spported by this transport.
+ virtual WebRtcRtpCaps getCaps() = 0;
jam 2013/10/11 16:47:14 nit: please check the google style guide
Alpha Left Google 2013/10/11 20:24:21 Oooops sorry.. Been doing too much blink lately.
+
+ // Return parameters set to this transport.
+ virtual WebRtcRtpParams getParams() = 0;
+
+ // Return the best parameters given the capabilities of remote peer.
+ virtual WebRtcRtpParams createParams(WebRtcRtpCaps remote_caps) = 0;
+
+ // Begin encoding of media stream from |track| and submit the encoded
+ // stream to underlying transport.
+ virtual void start(
+ WebKit::WebMediaStreamTrack* track,
+ WebRtcRtpParams params) = 0;
+
+ // Stop encoding.
+ virtual void stop() = 0;
+
+ protected:
+ virtual ~WebRtcCastSendTransport() {}
+};
+
+// Create a Cast send transport providing the underlying UDP transport.
+CONTENT_EXPORT WebRtcCastSendTransport* CreateWebRtcCastSendTransport(
jam 2013/10/11 16:47:14 nit: put this as a static method in WebRtcCastSend
Alpha Left Google 2013/10/11 20:24:21 Done.
+ WebRtcUdpTransport* udp_transport);
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_RENDERER_MEDIA_WEBRTC_CAST_SEND_TRANSPORT_H_

Powered by Google App Engine
This is Rietveld 408576698