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