Index: media/cast/transport/cast_transport_config.h |
diff --git a/media/cast/transport/cast_transport_config.h b/media/cast/transport/cast_transport_config.h |
index d7d3196857e8389f08d4b2d738c45ffc800264fd..b25ce4e28513b847c15c634ff7a4b44326a92969 100644 |
--- a/media/cast/transport/cast_transport_config.h |
+++ b/media/cast/transport/cast_transport_config.h |
@@ -12,6 +12,7 @@ |
#include "base/callback.h" |
#include "base/memory/linked_ptr.h" |
#include "base/memory/ref_counted.h" |
+#include "base/stl_util.h" |
#include "media/cast/transport/cast_transport_defines.h" |
#include "net/base/ip_endpoint.h" |
@@ -69,27 +70,68 @@ struct CastTransportVideoConfig { |
VideoCodec codec; |
}; |
-struct EncodedVideoFrame { |
- EncodedVideoFrame(); |
- ~EncodedVideoFrame(); |
+// A combination of metadata and data for one encoded frame. This can contain |
+// audio data or video data or other. |
+struct EncodedFrame { |
+ enum Dependency { |
+ // "null" value, used to indicate whether |dependency| has been set. |
+ UNKNOWN_DEPENDENCY, |
- VideoCodec codec; |
- bool key_frame; |
+ // Not decodable without the reference frame indicated by |
+ // |referenced_frame_id|. |
+ DEPENDENT, |
+ |
+ // Independently decodable. |
+ INDEPENDENT, |
+ |
+ // Independently decodable, and no future frames will depend on any frames |
+ // before this one. |
+ KEY, |
+ |
+ DEPENDENCY_LAST = KEY |
+ }; |
+ |
+ EncodedFrame(); |
+ ~EncodedFrame(); |
+ |
+ // Convenience accessors to data as an array of uint8 elements. |
+ const uint8* bytes() const { |
+ return reinterpret_cast<uint8*>(string_as_array( |
+ const_cast<std::string*>(&data))); |
+ } |
+ uint8* mutable_bytes() { |
+ return reinterpret_cast<uint8*>(string_as_array(&data)); |
+ } |
+ |
+ // This frame's dependency relationship with respect to other frames. |
+ Dependency dependency; |
+ |
+ // The label associated with this frame. Implies an ordering relative to |
+ // other frames in the same stream. |
uint32 frame_id; |
- uint32 last_referenced_frame_id; |
- uint32 rtp_timestamp; |
- std::string data; |
-}; |
-struct EncodedAudioFrame { |
- EncodedAudioFrame(); |
- ~EncodedAudioFrame(); |
+ // The label associated with the frame upon which this frame depends. If |
+ // this frame does not require any other frame in order to become decodable |
+ // (e.g., key frames), |referenced_frame_id| must equal |frame_id|. |
+ uint32 referenced_frame_id; |
- AudioCodec codec; |
- uint32 frame_id; // Needed to release the frame. |
+ // The stream timestamp, on the timeline of the signal data. For example, RTP |
+ // timestamps for audio are usually defined as the total number of audio |
+ // samples encoded in all prior frames. A playback system uses this value to |
+ // detect gaps in the stream, and otherwise stretch the signal to match |
+ // playout targets. |
uint32 rtp_timestamp; |
- // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration. |
- static const int kMaxNumberOfSamples = 48 * 2 * 100; |
+ |
+ // The common reference clock timestamp for this frame. This value originates |
+ // from a sender and is used to provide lip synchronization between streams in |
+ // a receiver. Thus, in the sender context, this is set to the time at which |
+ // the frame was captured/recorded. In the receiver context, this is set to |
+ // the target playout time. Over a sequence of frames, this time value is |
+ // expected to drift with respect to the elapsed time implied by the RTP |
+ // timestamps; and it may not necessarily increment with precise regularity. |
+ base::TimeTicks reference_time; |
+ |
+ // The encoded signal data. |
std::string data; |
}; |