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 MEDIA_CAST_CAST_CONFIG_H_ | 5 #ifndef MEDIA_CAST_CAST_CONFIG_H_ |
6 #define MEDIA_CAST_CAST_CONFIG_H_ | 6 #define MEDIA_CAST_CAST_CONFIG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 uint8 frame_id; // Needed to release the frame. Not used send side. | 169 uint8 frame_id; // Needed to release the frame. Not used send side. |
170 int samples; // Needed send side to advance the RTP timestamp. | 170 int samples; // Needed send side to advance the RTP timestamp. |
171 // Not used receive side. | 171 // Not used receive side. |
172 std::vector<uint8> data; | 172 std::vector<uint8> data; |
173 }; | 173 }; |
174 | 174 |
175 class PacketSender { | 175 class PacketSender { |
176 public: | 176 public: |
177 // All packets to be sent to the network will be delivered via this function. | 177 // All packets to be sent to the network will be delivered via this function. |
178 virtual bool SendPacket(const uint8* packet, int length) = 0; | 178 virtual bool SendPacket(const uint8* packet, int length) = 0; |
| 179 virtual bool SendPacket(const std::vector<uint8>& packet); |
179 | 180 |
180 virtual ~PacketSender() {} | 181 virtual ~PacketSender() {} |
181 }; | 182 }; |
182 | 183 |
183 class PacketReceiver : public base::RefCountedThreadSafe<PacketReceiver> { | 184 class PacketReceiver : public base::RefCountedThreadSafe<PacketReceiver> { |
184 public: | 185 public: |
185 // All packets received from the network should be delivered via this | 186 // All packets received from the network should be delivered via this |
186 // function. | 187 // function. |
187 virtual void ReceivedPacket(const uint8* packet, int length, | 188 virtual void ReceivedPacket(const uint8* packet, int length, |
188 const base::Closure callback) = 0; | 189 const base::Closure callback) = 0; |
189 | 190 |
| 191 protected: |
190 virtual ~PacketReceiver() {} | 192 virtual ~PacketReceiver() {} |
| 193 |
| 194 private: |
| 195 friend class base::RefCountedThreadSafe<PacketReceiver>; |
191 }; | 196 }; |
192 | 197 |
193 class VideoEncoderController { | 198 class VideoEncoderController { |
194 public: | 199 public: |
195 // Inform the encoder about the new target bit rate. | 200 // Inform the encoder about the new target bit rate. |
196 virtual void SetBitRate(int new_bit_rate) = 0; | 201 virtual void SetBitRate(int new_bit_rate) = 0; |
197 | 202 |
198 // Inform the encoder to not encode the next frame. | 203 // Inform the encoder to not encode the next frame. |
199 // Note: this setting is sticky and should last until called with false. | 204 // Note: this setting is sticky and should last until called with false. |
200 virtual void SkipNextFrame(bool skip_next_frame) = 0; | 205 virtual void SkipNextFrame(bool skip_next_frame) = 0; |
201 | 206 |
202 // Inform the encoder to encode the next frame as a key frame. | 207 // Inform the encoder to encode the next frame as a key frame. |
203 virtual void GenerateKeyFrame() = 0; | 208 virtual void GenerateKeyFrame() = 0; |
204 | 209 |
205 // Inform the encoder to only reference frames older or equal to frame_id; | 210 // Inform the encoder to only reference frames older or equal to frame_id; |
206 virtual void LatestFrameIdToReference(uint8 frame_id) = 0; | 211 virtual void LatestFrameIdToReference(uint8 frame_id) = 0; |
207 | 212 |
208 // Query the codec about how many frames it has skipped due to slow ACK. | 213 // Query the codec about how many frames it has skipped due to slow ACK. |
209 virtual int NumberOfSkippedFrames() const = 0; | 214 virtual int NumberOfSkippedFrames() const = 0; |
210 | 215 |
211 protected: | 216 protected: |
212 virtual ~VideoEncoderController() {} | 217 virtual ~VideoEncoderController() {} |
213 }; | 218 }; |
214 | 219 |
215 } // namespace cast | 220 } // namespace cast |
216 } // namespace media | 221 } // namespace media |
217 | 222 |
218 #endif // MEDIA_CAST_CAST_CONFIG_H_ | 223 #endif // MEDIA_CAST_CAST_CONFIG_H_ |
OLD | NEW |