Stats+Config moved into VideoSend/ReceiveStreams.
BUG=
R=mflodman@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/1561006
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4182 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/video_engine/new_include/video_receive_stream.h b/video_engine/new_include/video_receive_stream.h
index c4b324d..d8575ba 100644
--- a/video_engine/new_include/video_receive_stream.h
+++ b/video_engine/new_include/video_receive_stream.h
@@ -26,41 +26,6 @@
namespace newapi {
-struct ReceiveStatistics {
- RtpStatistics rtp_stats;
- int network_frame_rate;
- int decode_frame_rate;
- int render_frame_rate;
- uint32_t key_frames;
- uint32_t delta_frames;
- uint32_t video_packets;
- uint32_t retransmitted_packets;
- uint32_t fec_packets;
- uint32_t padding_packets;
- uint32_t discarded_packets;
- int32_t received_bitrate_bps;
- int receive_side_delay_ms;
-};
-
-// Receive stream specific RTP settings.
-struct RtpReceiveConfig {
- RtpReceiveConfig() : ssrc(0), nack(NULL), fec(NULL) {}
- // TODO(mflodman) Do we require a set ssrc? What happens if the ssrc changes?
- uint32_t ssrc;
-
- // See NackConfig for description, 'NULL' disables NACK.
- NackConfig* nack;
-
- // See FecConfig for description, 'NULL' disables FEC.
- FecConfig* fec;
-
- // RTX settings for possible payloads. RTX is disabled if the vector is empty.
- std::vector<RtxConfig> rtx;
-
- // RTP header extensions used for the received stream.
- std::vector<RtpExtension> rtp_extensions;
-};
-
// TODO(mflodman) Move all these settings to VideoDecoder and move the
// declaration to common_types.h.
struct ExternalVideoDecoder {
@@ -83,60 +48,117 @@
int expected_delay_ms;
};
-struct VideoReceiveStreamConfig {
- VideoReceiveStreamConfig()
- : renderer(NULL),
- render_delay_ms(0),
- audio_channel_id(0),
- pre_decode_callback(NULL),
- post_decode_callback(NULL),
- target_delay_ms(0) {}
- // Codecs the receive stream
- std::vector<VideoCodec> codecs;
-
- RtpReceiveConfig rtp;
-
- // VideoRenderer will be called for each decoded frame. 'NULL' disables
- // rendering of this stream.
- VideoRenderer* renderer;
-
- // Expected delay needed by the renderer, i.e. the frame will be delivered
- // this many milliseconds, if possible, earlier than the ideal render time.
- // Only valid if 'renderer' is set.
- int render_delay_ms;
-
- // Audio channel corresponding to this video stream, used for audio/video
- // synchronization. 'audio_channel_id' is ignored if no VoiceEngine is set
- // when creating the VideoEngine instance. '-1' disables a/v sync.
- int audio_channel_id;
-
- // Called for each incoming video frame, i.e. in encoded state. E.g. used when
- // saving the stream to a file. 'NULL' disables the callback.
- EncodedFrameObserver* pre_decode_callback;
-
- // Called for each decoded frame. E.g. used when adding effects to the decoded
- // stream. 'NULL' disables the callback.
- I420FrameCallback* post_decode_callback;
-
- // External video decoders to be used if incoming payload type matches the
- // registered type for an external decoder.
- std::vector<ExternalVideoDecoder> external_decoders;
-
- // Target delay in milliseconds. A positive value indicates this stream is
- // used for streaming instead of a real-time call.
- int target_delay_ms;
-};
-
class VideoReceiveStream {
public:
+ struct Stats {
+ Stats()
+ : network_frame_rate(0),
+ decode_frame_rate(0),
+ render_frame_rate(0),
+ key_frames(0),
+ delta_frames(0),
+ video_packets(0),
+ retransmitted_packets(0),
+ fec_packets(0),
+ padding_packets(0),
+ discarded_packets(0),
+ received_bitrate_bps(0),
+ receive_side_delay_ms(0) {}
+ RtpStatistics rtp_stats;
+ int network_frame_rate;
+ int decode_frame_rate;
+ int render_frame_rate;
+ uint32_t key_frames;
+ uint32_t delta_frames;
+ uint32_t video_packets;
+ uint32_t retransmitted_packets;
+ uint32_t fec_packets;
+ uint32_t padding_packets;
+ uint32_t discarded_packets;
+ int32_t received_bitrate_bps;
+ int receive_side_delay_ms;
+ };
+
+ class StatsCallback {
+ public:
+ virtual ~StatsCallback() {}
+ virtual void ReceiveStats(const Stats& stats) = 0;
+ };
+
+ struct Config {
+ Config()
+ : renderer(NULL),
+ render_delay_ms(0),
+ audio_channel_id(0),
+ pre_decode_callback(NULL),
+ post_decode_callback(NULL),
+ target_delay_ms(0) {}
+ // Codecs the receive stream
+ std::vector<VideoCodec> codecs;
+
+ // Receive-stream specific RTP settings.
+ struct Rtp {
+ Rtp() : ssrc(0) {}
+ // TODO(mflodman) Do we require a set ssrc? What happens if the ssrc
+ // changes?
+ uint32_t ssrc;
+
+ // See NackConfig for description.
+ NackConfig nack;
+
+ // See FecConfig for description.
+ FecConfig fec;
+
+ // RTX settings for possible payloads. RTX is disabled if the vector is
+ // empty.
+ std::vector<RtxConfig> rtx;
+
+ // RTP header extensions used for the received stream.
+ std::vector<RtpExtension> extensions;
+ } rtp;
+
+ // VideoRenderer will be called for each decoded frame. 'NULL' disables
+ // rendering of this stream.
+ VideoRenderer* renderer;
+
+ // Expected delay needed by the renderer, i.e. the frame will be delivered
+ // this many milliseconds, if possible, earlier than the ideal render time.
+ // Only valid if 'renderer' is set.
+ int render_delay_ms;
+
+ // Audio channel corresponding to this video stream, used for audio/video
+ // synchronization. 'audio_channel_id' is ignored if no VoiceEngine is set
+ // when creating the VideoEngine instance. '-1' disables a/v sync.
+ int audio_channel_id;
+
+ // Called for each incoming video frame, i.e. in encoded state. E.g. used
+ // when
+ // saving the stream to a file. 'NULL' disables the callback.
+ EncodedFrameObserver* pre_decode_callback;
+
+ // Called for each decoded frame. E.g. used when adding effects to the
+ // decoded
+ // stream. 'NULL' disables the callback.
+ I420FrameCallback* post_decode_callback;
+
+ // External video decoders to be used if incoming payload type matches the
+ // registered type for an external decoder.
+ std::vector<ExternalVideoDecoder> external_decoders;
+
+ // Target delay in milliseconds. A positive value indicates this stream is
+ // used for streaming instead of a real-time call.
+ int target_delay_ms;
+
+ // Callback for periodically receiving receiver stats.
+ StatsCallback* stats_callback;
+ };
+
virtual void StartReceive() = 0;
virtual void StopReceive() = 0;
// TODO(mflodman) Replace this with callback.
virtual void GetCurrentReceiveCodec(VideoCodec* receive_codec) = 0;
- virtual void GetReceiveStatistics(ReceiveStatistics* statistics) = 0;
-
protected:
virtual ~VideoReceiveStream() {}
};