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.
5 #ifndef CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_
6 #define CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
20 // A key value pair structure for codec specific parameters.
21 struct CastCodecSpecificParams
{
25 CastCodecSpecificParams();
26 ~CastCodecSpecificParams();
29 // Defines the basic properties of a payload supported by cast transport.
30 struct CastRtpPayloadParams
{
31 // RTP specific field that identifies the content type.
34 // RTP specific field to identify a stream.
37 // RTP specific field to idenfity the feedback stream.
40 // Update frequency of payload sample.
49 // Number of audio channels.
52 // Width and height of the video content.
56 // Name of the codec used.
57 std::string codec_name
;
59 // AES encryption key.
62 // AES encryption IV mask.
63 std::string aes_iv_mask
;
65 // List of codec specific parameters.
66 std::vector
<CastCodecSpecificParams
> codec_specific_params
;
68 CastRtpPayloadParams();
69 ~CastRtpPayloadParams();
72 // Defines the parameters of a RTP stream.
73 struct CastRtpParams
{
74 explicit CastRtpParams(const CastRtpPayloadParams
& payload_params
);
76 // Payload parameters.
77 CastRtpPayloadParams payload
;
79 // Names of supported RTCP features.
80 std::vector
<std::string
> rtcp_features
;
86 // This object represents a RTP stream that encodes and optionally
87 // encrypt audio or video data from a WebMediaStreamTrack.
88 // Note that this object does not actually output packets. It allows
89 // configuration of encoding and RTP parameters and control such a logical
93 CastRtpStream(const blink::WebMediaStreamTrack
& track
,
94 const scoped_refptr
<CastSession
>& session
);
97 // Return parameters currently supported by this stream.
98 std::vector
<CastRtpParams
> GetSupportedParams();
100 // Return parameters set to this stream.
101 CastRtpParams
GetParams();
103 // Begin encoding of media stream and then submit the encoded streams
104 // to underlying transport.
105 void Start(const CastRtpParams
& params
);
111 // Return true if this track is an audio track. Return false if this
112 // track is a video track.
113 bool IsAudio() const;
115 blink::WebMediaStreamTrack track_
;
116 const scoped_refptr
<CastSession
> cast_session_
;
117 scoped_ptr
<CastAudioSink
> audio_sink_
;
118 scoped_ptr
<CastVideoSink
> video_sink_
;
119 CastRtpParams params_
;
121 DISALLOW_COPY_AND_ASSIGN(CastRtpStream
);
124 #endif // CHROME_RENDERER_MEDIA_CAST_RTP_STREAM_H_