OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 #ifndef CHROME_RENDERER_MEDIA_CAST_SEND_TRANSPORT_H_ |
| 6 #define CHROME_RENDERER_MEDIA_CAST_SEND_TRANSPORT_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 |
| 13 namespace WebKit { |
| 14 class WebMediaStreamTrack; |
| 15 } // namespace WebKit |
| 16 |
| 17 class CastUdpTransport; |
| 18 |
| 19 // A key value pair structure for codec specific parameters. |
| 20 struct CastCodecSpecificParam { |
| 21 std::string key; |
| 22 std::string value; |
| 23 |
| 24 CastCodecSpecificParam(); |
| 25 ~CastCodecSpecificParam(); |
| 26 }; |
| 27 |
| 28 // Defines the basic properties of a payload supported by cast transport. |
| 29 struct CastRtpPayloadParam { |
| 30 // RTP specific field that identifies the content type. |
| 31 int payload_type; |
| 32 |
| 33 // RTP specific field to identify a stream. |
| 34 int ssrc; |
| 35 |
| 36 // Update frequency of payload sample. |
| 37 int clock_rate; |
| 38 |
| 39 // Uncompressed bitrate. |
| 40 int bitrate; |
| 41 |
| 42 // Number of audio channels. |
| 43 int channels; |
| 44 |
| 45 // Width and height of the video content. |
| 46 int width; |
| 47 int height; |
| 48 |
| 49 // Name of the codec used. |
| 50 std::string codec_name; |
| 51 |
| 52 // List of codec specific parameters. |
| 53 std::vector<CastCodecSpecificParam> codec_specific_params; |
| 54 |
| 55 CastRtpPayloadParam(); |
| 56 ~CastRtpPayloadParam(); |
| 57 }; |
| 58 |
| 59 // Defines the capabilities of the transport. |
| 60 struct CastRtpCaps { |
| 61 // Defines a list of supported payloads. |
| 62 std::vector<CastRtpPayloadParam> payloads; |
| 63 |
| 64 // Names of supported RTCP features. |
| 65 std::vector<std::string> rtcp_features; |
| 66 |
| 67 // Names of supported FEC (Forward Error Correction) mechanisms. |
| 68 std::vector<std::string> fec_mechanism; |
| 69 |
| 70 CastRtpCaps(); |
| 71 ~CastRtpCaps(); |
| 72 }; |
| 73 |
| 74 typedef CastRtpCaps CastRtpParams; |
| 75 |
| 76 // This class takes input from audio and/or video WebMediaStreamTracks |
| 77 // and then send the encoded streams to the underlying transport, |
| 78 // e.g. a UDP transport. It also allows configuration of the encoded |
| 79 // stream. |
| 80 class CastSendTransport { |
| 81 public: |
| 82 CastSendTransport(CastUdpTransport* udp_transport); |
| 83 virtual ~CastSendTransport(); |
| 84 |
| 85 // Return capabilities currently spported by this transport. |
| 86 CastRtpCaps GetCaps(); |
| 87 |
| 88 // Return parameters set to this transport. |
| 89 CastRtpParams GetParams(); |
| 90 |
| 91 // Return the best parameters given the capabilities of remote peer. |
| 92 CastRtpParams CreateParams(CastRtpCaps remote_caps); |
| 93 |
| 94 // Begin encoding of media stream from |audio_track| and |video_track| |
| 95 // and then submit the encoded streams to underlying transport. |
| 96 // Either stream can be NULL but it is invalid for both streams to be |
| 97 // NULL. |
| 98 void Start(WebKit::WebMediaStreamTrack* audio_track, |
| 99 WebKit::WebMediaStreamTrack* video_track, |
| 100 CastRtpParams params); |
| 101 |
| 102 // Stop encoding. |
| 103 void Stop(); |
| 104 |
| 105 private: |
| 106 DISALLOW_COPY_AND_ASSIGN(CastSendTransport); |
| 107 }; |
| 108 |
| 109 #endif // CHROME_RENDERER_MEDIA_CAST_SEND_TRANSPORT_H_ |
OLD | NEW |