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 #include "base/memory/ref_counted.h" | |
13 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | |
14 | |
15 class CastSession; | |
16 | |
17 // A key value pair structure for codec specific parameters. | |
18 struct CastCodecSpecificParams { | |
19 std::string key; | |
20 std::string value; | |
21 | |
22 CastCodecSpecificParams(); | |
23 ~CastCodecSpecificParams(); | |
24 }; | |
25 | |
26 // Defines the basic properties of a payload supported by cast transport. | |
27 struct CastRtpPayloadParams { | |
28 // RTP specific field that identifies the content type. | |
29 int payload_type; | |
30 | |
31 // RTP specific field to identify a stream. | |
32 int ssrc; | |
33 | |
34 // Update frequency of payload sample. | |
35 int clock_rate; | |
36 | |
37 // Maximum bitrate. | |
38 int max_bitrate; | |
39 | |
40 // Minimum bitrate. | |
41 int min_bitrate; | |
42 | |
43 // Number of audio channels. | |
44 int channels; | |
45 | |
46 // Width and height of the video content. | |
47 int width; | |
48 int height; | |
49 | |
50 // Name of the codec used. | |
51 std::string codec_name; | |
52 | |
53 // List of codec specific parameters. | |
54 std::vector<CastCodecSpecificParams> codec_specific_params; | |
55 | |
56 CastRtpPayloadParams(); | |
57 ~CastRtpPayloadParams(); | |
58 }; | |
59 | |
60 // Defines the capabilities of the transport. | |
61 struct CastRtpCaps { | |
62 // Defines a list of supported payloads. | |
63 std::vector<CastRtpPayloadParams> payloads; | |
64 | |
65 // Names of supported RTCP features. | |
66 std::vector<std::string> rtcp_features; | |
67 | |
68 // Names of supported FEC (Forward Error Correction) mechanisms. | |
69 std::vector<std::string> fec_mechanisms; | |
70 | |
71 CastRtpCaps(); | |
72 ~CastRtpCaps(); | |
73 }; | |
74 | |
75 typedef CastRtpCaps CastRtpParams; | |
76 | |
77 // This object represents a RTP stream that encodes and optionally | |
78 // encrypt audio or video data from a WebMediaStreamTrack. | |
79 // Note that this object does not actually output packets. It allows | |
80 // configuration of encoding and RTP parameters and control such a logical | |
81 // stream. | |
82 class CastSendTransport { | |
83 public: | |
84 CastSendTransport(const blink::WebMediaStreamTrack& track, | |
85 const scoped_refptr<CastSession>& session); | |
86 ~CastSendTransport(); | |
87 | |
88 // Return capabilities currently supported by this transport. | |
89 CastRtpCaps GetCaps(); | |
90 | |
91 // Return parameters set to this transport. | |
92 CastRtpParams GetParams(); | |
93 | |
94 // Begin encoding of media stream and then submit the encoded streams | |
95 // to underlying transport. | |
96 void Start(const CastRtpParams& params); | |
97 | |
98 // Stop encoding. | |
99 void Stop(); | |
100 | |
101 private: | |
102 // Return true if this track is an audio track. Return false if this | |
103 // track is a video track. | |
104 bool IsAudio() const; | |
105 | |
106 blink::WebMediaStreamTrack track_; | |
107 const scoped_refptr<CastSession> cast_session_; | |
108 CastRtpParams params_; | |
109 | |
110 DISALLOW_COPY_AND_ASSIGN(CastSendTransport); | |
111 }; | |
112 | |
113 #endif // CHROME_RENDERER_MEDIA_CAST_SEND_TRANSPORT_H_ | |
OLD | NEW |