Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(916)

Side by Side Diff: media/cast/sender/video_sender.h

Issue 502333002: [Cast] In Audio/VideoSender, drop frames when too-long a duration is in-flight. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing brace (rebase oops). Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/cast/sender/rtp_timestamp_helper.cc ('k') | media/cast/sender/video_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SENDER_VIDEO_SENDER_H_ 5 #ifndef MEDIA_CAST_SENDER_VIDEO_SENDER_H_
6 #define MEDIA_CAST_SENDER_VIDEO_SENDER_H_ 6 #define MEDIA_CAST_SENDER_VIDEO_SENDER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Note: It is invalid to call this method if InitializationResult() returns 54 // Note: It is invalid to call this method if InitializationResult() returns
55 // anything but STATUS_VIDEO_INITIALIZED. 55 // anything but STATUS_VIDEO_INITIALIZED.
56 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, 56 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
57 const base::TimeTicks& capture_time); 57 const base::TimeTicks& capture_time);
58 58
59 protected: 59 protected:
60 // Protected for testability. 60 // Protected for testability.
61 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); 61 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback);
62 62
63 private: 63 private:
64 // Returns true if there are too many frames in flight, as defined by the 64 // Returns true if there are too many frames in flight, or if the media
65 // configured target playout delay plus simple logic. When this is true, 65 // duration of the frames in flight would be too high by sending the next
66 // InsertRawVideoFrame() will silenty drop frames instead of sending them to 66 // frame. The latter metric is determined from the given |capture_time|
67 // the video encoder. 67 // for the next frame to be encoded and sent.
68 bool AreTooManyFramesInFlight() const; 68 bool ShouldDropNextFrame(base::TimeTicks capture_time) const;
69 69
70 // Called by the |video_encoder_| with the next EncodeFrame to send. 70 // Called by the |video_encoder_| with the next EncodeFrame to send.
71 void SendEncodedVideoFrame(int requested_bitrate_before_encode, 71 void SendEncodedVideoFrame(int requested_bitrate_before_encode,
72 scoped_ptr<EncodedFrame> encoded_frame); 72 scoped_ptr<EncodedFrame> encoded_frame);
73 // If this value is non zero then a fixed value is used for bitrate. 73 // If this value is non zero then a fixed value is used for bitrate.
74 // If external video encoder is used then bitrate will be fixed to 74 // If external video encoder is used then bitrate will be fixed to
75 // (min_bitrate + max_bitrate) / 2. 75 // (min_bitrate + max_bitrate) / 2.
76 const size_t fixed_bitrate_; 76 const size_t fixed_bitrate_;
77 77
78 // Encodes media::VideoFrame images into EncodedFrames. Per configuration, 78 // Encodes media::VideoFrame images into EncodedFrames. Per configuration,
(...skipping 12 matching lines...) Expand all
91 // NOTE: Weak pointers must be invalidated before all other member variables. 91 // NOTE: Weak pointers must be invalidated before all other member variables.
92 base::WeakPtrFactory<VideoSender> weak_factory_; 92 base::WeakPtrFactory<VideoSender> weak_factory_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(VideoSender); 94 DISALLOW_COPY_AND_ASSIGN(VideoSender);
95 }; 95 };
96 96
97 } // namespace cast 97 } // namespace cast
98 } // namespace media 98 } // namespace media
99 99
100 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ 100 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_
OLDNEW
« no previous file with comments | « media/cast/sender/rtp_timestamp_helper.cc ('k') | media/cast/sender/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698