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 MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" |
| 14 |
| 15 namespace media { |
| 16 namespace cast { |
| 17 namespace transport { |
| 18 |
| 19 enum RtcpMode { |
| 20 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. |
| 21 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. |
| 22 }; |
| 23 |
| 24 enum VideoCodec { |
| 25 kVp8, |
| 26 kH264, |
| 27 kExternalVideo, |
| 28 }; |
| 29 |
| 30 enum AudioCodec { |
| 31 kOpus, |
| 32 kPcm16, |
| 33 kExternalAudio, |
| 34 }; |
| 35 |
| 36 struct CastTransportConfig { |
| 37 CastTransportConfig(); |
| 38 ~CastTransportConfig(); |
| 39 uint32 sender_ssrc; |
| 40 |
| 41 VideoCodec video_codec; |
| 42 AudioCodec audio_codec; |
| 43 |
| 44 int rtp_history_ms; |
| 45 int rtp_max_delay_ms; |
| 46 int rtp_payload_type; |
| 47 |
| 48 int frequency; |
| 49 int channels; |
| 50 |
| 51 std::string aes_key; // Binary string of size kAesKeySize. |
| 52 std::string aes_iv_mask; // Binary string of size kAesBlockSize. |
| 53 }; |
| 54 |
| 55 struct EncodedVideoFrame { |
| 56 EncodedVideoFrame(); |
| 57 ~EncodedVideoFrame(); |
| 58 |
| 59 VideoCodec codec; |
| 60 bool key_frame; |
| 61 uint32 frame_id; |
| 62 uint32 last_referenced_frame_id; |
| 63 std::string data; |
| 64 }; |
| 65 |
| 66 struct EncodedAudioFrame { |
| 67 EncodedAudioFrame(); |
| 68 ~EncodedAudioFrame(); |
| 69 |
| 70 AudioCodec codec; |
| 71 uint32 frame_id; // Needed to release the frame. |
| 72 int samples; // Needed send side to advance the RTP timestamp. |
| 73 // Not used receive side. |
| 74 // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration. |
| 75 static const int kMaxNumberOfSamples = 48 * 2 * 100; |
| 76 std::string data; |
| 77 }; |
| 78 |
| 79 typedef std::vector<uint8> Packet; |
| 80 typedef std::vector<Packet> PacketList; |
| 81 |
| 82 class PacketReceiver : public base::RefCountedThreadSafe<PacketReceiver> { |
| 83 public: |
| 84 // All packets received from the network should be delivered via this |
| 85 // function. |
| 86 virtual void ReceivedPacket(const uint8* packet, size_t length, |
| 87 const base::Closure callback) = 0; |
| 88 |
| 89 static void DeletePacket(const uint8* packet); |
| 90 |
| 91 protected: |
| 92 virtual ~PacketReceiver() {} |
| 93 |
| 94 private: |
| 95 friend class base::RefCountedThreadSafe<PacketReceiver>; |
| 96 }; |
| 97 |
| 98 } // namespace transport |
| 99 } // namespace cast |
| 100 } // namespace media |
| 101 |
| 102 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
OLD | NEW |