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

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

Issue 560223002: [Cast] Limit frames in flight by duration, and not by number of frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaks. 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/frame_sender.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // sent, if VideoSender detects too many frames in flight. Therefore, clients 51 // sent, if VideoSender detects too many frames in flight. Therefore, clients
52 // should be careful about the rate at which this method is called. 52 // should be careful about the rate at which this method is called.
53 // 53 //
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 virtual int GetNumberOfFramesInEncoder() const OVERRIDE; 60 virtual int GetNumberOfFramesInEncoder() const OVERRIDE;
61 virtual base::TimeDelta GetInFlightMediaDuration() const OVERRIDE;
61 virtual void OnAck(uint32 frame_id) OVERRIDE; 62 virtual void OnAck(uint32 frame_id) OVERRIDE;
62 63
63 private: 64 private:
64 // Called when the encoder is initialized or has failed to initialize. 65 // Called when the encoder is initialized or has failed to initialize.
65 void OnEncoderInitialized( 66 void OnEncoderInitialized(
66 const CastInitializationCallback& initialization_cb, 67 const CastInitializationCallback& initialization_cb,
67 CastInitializationStatus status); 68 CastInitializationStatus status);
68 69
69 // Called by the |video_encoder_| with the next EncodedFrame to send. 70 // Called by the |video_encoder_| with the next EncodedFrame to send.
70 void OnEncodedVideoFrame(int encoder_bitrate, 71 void OnEncodedVideoFrame(int encoder_bitrate,
71 scoped_ptr<EncodedFrame> encoded_frame); 72 scoped_ptr<EncodedFrame> encoded_frame);
72 73
73 // Encodes media::VideoFrame images into EncodedFrames. Per configuration, 74 // Encodes media::VideoFrame images into EncodedFrames. Per configuration,
74 // this will point to either the internal software-based encoder or a proxy to 75 // this will point to either the internal software-based encoder or a proxy to
75 // a hardware-based encoder. 76 // a hardware-based encoder.
76 scoped_ptr<VideoEncoder> video_encoder_; 77 scoped_ptr<VideoEncoder> video_encoder_;
77 78
78 // The number of frames queued for encoding, but not yet sent. 79 // The number of frames queued for encoding, but not yet sent.
79 int frames_in_encoder_; 80 int frames_in_encoder_;
80 81
82 // The duration of video queued for encoding, but not yet sent.
83 base::TimeDelta duration_in_encoder_;
84
85 // The timestamp of the frame that was last enqueued in |video_encoder_|.
86 base::TimeTicks last_enqueued_frame_reference_time_;
87
81 // Remember what we set the bitrate to before, no need to set it again if 88 // Remember what we set the bitrate to before, no need to set it again if
82 // we get the same value. 89 // we get the same value.
83 uint32 last_bitrate_; 90 uint32 last_bitrate_;
84 91
85 PlayoutDelayChangeCB playout_delay_change_cb_; 92 PlayoutDelayChangeCB playout_delay_change_cb_;
86 93
87 // NOTE: Weak pointers must be invalidated before all other member variables. 94 // NOTE: Weak pointers must be invalidated before all other member variables.
88 base::WeakPtrFactory<VideoSender> weak_factory_; 95 base::WeakPtrFactory<VideoSender> weak_factory_;
89 96
90 DISALLOW_COPY_AND_ASSIGN(VideoSender); 97 DISALLOW_COPY_AND_ASSIGN(VideoSender);
91 }; 98 };
92 99
93 } // namespace cast 100 } // namespace cast
94 } // namespace media 101 } // namespace media
95 102
96 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ 103 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_
OLDNEW
« no previous file with comments | « media/cast/sender/frame_sender.cc ('k') | media/cast/sender/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698