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