Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ | 5 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ | 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/stl_util.h" | |
| 15 #include "media/cast/transport/cast_transport_defines.h" | 16 #include "media/cast/transport/cast_transport_defines.h" |
| 16 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 namespace cast { | 20 namespace cast { |
| 20 namespace transport { | 21 namespace transport { |
| 21 | 22 |
| 22 enum RtcpMode { | 23 enum RtcpMode { |
| 23 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. | 24 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. |
| 24 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. | 25 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 struct CastTransportVideoConfig { | 65 struct CastTransportVideoConfig { |
| 65 CastTransportVideoConfig(); | 66 CastTransportVideoConfig(); |
| 66 ~CastTransportVideoConfig(); | 67 ~CastTransportVideoConfig(); |
| 67 | 68 |
| 68 CastTransportRtpConfig rtp; | 69 CastTransportRtpConfig rtp; |
| 69 VideoCodec codec; | 70 VideoCodec codec; |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 struct EncodedVideoFrame { | 73 // A combination of metadata and data for one encoded frame. This can contain |
| 73 EncodedVideoFrame(); | 74 // audio data or video data or other. |
| 74 ~EncodedVideoFrame(); | 75 struct EncodedFrame { |
| 76 EncodedFrame(); | |
| 77 ~EncodedFrame(); | |
| 75 | 78 |
| 76 VideoCodec codec; | 79 // Convenience accessors to data as an array of uint8 elements. |
| 77 bool key_frame; | 80 const uint8* bytes() const { |
| 81 return reinterpret_cast<uint8*>(string_as_array( | |
| 82 const_cast<std::string*>(&data))); | |
| 83 } | |
| 84 uint8* mutable_bytes() { | |
| 85 return reinterpret_cast<uint8*>(string_as_array(&data)); | |
| 86 } | |
| 87 | |
| 88 // This frame's relationship with respect to other frames. | |
| 89 enum Relationship { | |
|
Alpha Left Google
2014/05/16 18:35:22
It seems to me this enum should be called "Depende
miu
2014/05/16 21:28:46
Done.
| |
| 90 // "null" value, used to indicate this field has not been set. | |
| 91 UNKNOWN_RELATIONSHIP, | |
|
Alpha Left Google
2014/05/16 18:35:22
This is not used and will not be used. Please remo
miu
2014/05/16 21:28:46
Done. It was being used to check that the field w
hubbe
2014/05/19 17:54:43
I kind of liked UNKNOWN_RELATIONSHIP.
| |
| 92 | |
| 93 // Not decodable without the reference frame. | |
|
Alpha Left Google
2014/05/16 18:35:22
This comment needs to be clarified: without the re
miu
2014/05/16 21:28:46
Done.
| |
| 94 DEPENDENT, | |
| 95 | |
| 96 // Independently decodable. | |
| 97 INDEPENDENT, | |
| 98 | |
| 99 // Independently decodable, and no future frames will depend on any frames | |
| 100 // before this one. | |
| 101 KEY, | |
| 102 | |
| 103 RELATIONSHIP_LAST = KEY | |
| 104 } relationship; | |
|
hubbe
2014/05/16 17:13:20
I think it's more clear to separate the enum decla
hubbe
2014/05/16 17:13:20
I'm not sure I think "relationship" describes this
miu
2014/05/16 21:28:46
Done.
miu
2014/05/16 21:28:46
Done. Changed it to "dependency," per team discus
| |
| 105 | |
| 106 // The label associated with this frame. Implies an ordering relative to | |
| 107 // other frames in the same stream. | |
| 78 uint32 frame_id; | 108 uint32 frame_id; |
| 79 uint32 last_referenced_frame_id; | 109 |
| 110 // The label associated with the frame upon which this frame depends. If | |
| 111 // this frame does not require any other frame in order to become decodable | |
| 112 // (e.g., key frames), |referenced_frame_id| must equal |frame_id|. | |
| 113 uint32 referenced_frame_id; | |
| 114 | |
| 115 // The stream timestamp, on the timeline of the signal data. For example, RTP | |
| 116 // timestamps for audio are usually defined as the total number of audio | |
| 117 // samples encoded in all prior frames. A playback system uses this value to | |
| 118 // detect gaps in the stream, and otherwise stretch the signal to match | |
| 119 // playout targets. | |
| 80 uint32 rtp_timestamp; | 120 uint32 rtp_timestamp; |
| 121 | |
| 122 // The common reference clock timestamp for this frame. This value originates | |
| 123 // from a sender and is used to provide lip synchronization between streams in | |
| 124 // a receiver. Thus, in the sender context, this is set to the time at which | |
| 125 // the frame was captured/recorded. In the receiver context, this is set to | |
| 126 // the target playout time. Over a sequence of frames, this time value is | |
| 127 // expected to drift with respect to the elapsed time implied by the RTP | |
| 128 // timestamps; and it may not necessarily increment with precise regularity. | |
| 129 base::TimeTicks reference_time; | |
| 130 | |
| 131 // The encoded signal data. | |
| 81 std::string data; | 132 std::string data; |
| 82 }; | 133 }; |
| 83 | 134 |
| 84 struct EncodedAudioFrame { | |
| 85 EncodedAudioFrame(); | |
| 86 ~EncodedAudioFrame(); | |
| 87 | |
| 88 AudioCodec codec; | |
| 89 uint32 frame_id; // Needed to release the frame. | |
| 90 uint32 rtp_timestamp; | |
| 91 // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration. | |
| 92 static const int kMaxNumberOfSamples = 48 * 2 * 100; | |
| 93 std::string data; | |
| 94 }; | |
| 95 | |
| 96 typedef std::vector<uint8> Packet; | 135 typedef std::vector<uint8> Packet; |
| 97 typedef scoped_refptr<base::RefCountedData<Packet> > PacketRef; | 136 typedef scoped_refptr<base::RefCountedData<Packet> > PacketRef; |
| 98 typedef std::vector<PacketRef> PacketList; | 137 typedef std::vector<PacketRef> PacketList; |
| 99 | 138 |
| 100 typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback; | 139 typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback; |
| 101 | 140 |
| 102 class PacketSender { | 141 class PacketSender { |
| 103 public: | 142 public: |
| 104 // Send a packet to the network. Returns false if the network is blocked | 143 // Send a packet to the network. Returns false if the network is blocked |
| 105 // and we should wait for |cb| to be called. It is not allowed to called | 144 // and we should wait for |cb| to be called. It is not allowed to called |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 lhs.rtp_timestamp == rhs.rtp_timestamp && | 197 lhs.rtp_timestamp == rhs.rtp_timestamp && |
| 159 lhs.send_packet_count == rhs.send_packet_count && | 198 lhs.send_packet_count == rhs.send_packet_count && |
| 160 lhs.send_octet_count == rhs.send_octet_count; | 199 lhs.send_octet_count == rhs.send_octet_count; |
| 161 } | 200 } |
| 162 | 201 |
| 163 } // namespace transport | 202 } // namespace transport |
| 164 } // namespace cast | 203 } // namespace cast |
| 165 } // namespace media | 204 } // namespace media |
| 166 | 205 |
| 167 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ | 206 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| OLD | NEW |