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

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

Issue 901833004: [Cast] Repurpose CastInitializationStatus for variable frame size support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fixes. Created 5 years, 10 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
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 22 matching lines...) Expand all
33 // packets, congestion control, video encoder, parsing and sending of 33 // packets, congestion control, video encoder, parsing and sending of
34 // RTCP packets. 34 // RTCP packets.
35 // Additionally it posts a bunch of delayed tasks to the main thread for various 35 // Additionally it posts a bunch of delayed tasks to the main thread for various
36 // timeouts. 36 // timeouts.
37 class VideoSender : public FrameSender, 37 class VideoSender : public FrameSender,
38 public base::NonThreadSafe, 38 public base::NonThreadSafe,
39 public base::SupportsWeakPtr<VideoSender> { 39 public base::SupportsWeakPtr<VideoSender> {
40 public: 40 public:
41 VideoSender(scoped_refptr<CastEnvironment> cast_environment, 41 VideoSender(scoped_refptr<CastEnvironment> cast_environment,
42 const VideoSenderConfig& video_config, 42 const VideoSenderConfig& video_config,
43 const CastInitializationCallback& initialization_cb, 43 const StatusChangeCallback& status_change_cb,
44 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 44 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
45 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, 45 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb,
46 CastTransportSender* const transport_sender, 46 CastTransportSender* const transport_sender,
47 const PlayoutDelayChangeCB& playout_delay_change_cb); 47 const PlayoutDelayChangeCB& playout_delay_change_cb);
48 48
49 ~VideoSender() override; 49 ~VideoSender() override;
50 50
51 // Note: It is not guaranteed that |video_frame| will actually be encoded and 51 // Note: It is not guaranteed that |video_frame| will actually be encoded and
52 // sent, if VideoSender detects too many frames in flight. Therefore, clients 52 // sent, if VideoSender detects too many frames in flight. Therefore, clients
53 // should be careful about the rate at which this method is called. 53 // should be careful about the rate at which this method is called.
54 //
55 // Note: It is invalid to call this method if InitializationResult() returns
56 // anything but STATUS_VIDEO_INITIALIZED.
57 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, 54 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
58 const base::TimeTicks& reference_time); 55 const base::TimeTicks& reference_time);
59 56
60 // Creates a |VideoFrameFactory| object to vend |VideoFrame| object with 57 // Creates a |VideoFrameFactory| object to vend |VideoFrame| object with
61 // encoder affinity (defined as offering some sort of performance benefit). If 58 // encoder affinity (defined as offering some sort of performance benefit). If
62 // the encoder does not have any such capability, returns null. 59 // the encoder does not have any such capability, returns null.
63 scoped_ptr<VideoFrameFactory> CreateVideoFrameFactory(); 60 scoped_ptr<VideoFrameFactory> CreateVideoFrameFactory();
64 61
65 protected: 62 protected:
66 int GetNumberOfFramesInEncoder() const override; 63 int GetNumberOfFramesInEncoder() const override;
67 base::TimeDelta GetInFlightMediaDuration() const override; 64 base::TimeDelta GetInFlightMediaDuration() const override;
68 void OnAck(uint32 frame_id) override; 65 void OnAck(uint32 frame_id) override;
69 66
70 private: 67 private:
71 // Called when the encoder is initialized or has failed to initialize.
72 void OnEncoderInitialized(
73 const CastInitializationCallback& initialization_cb,
74 CastInitializationStatus status);
75
76 // Called by the |video_encoder_| with the next EncodedFrame to send. 68 // Called by the |video_encoder_| with the next EncodedFrame to send.
77 void OnEncodedVideoFrame(int encoder_bitrate, 69 void OnEncodedVideoFrame(int encoder_bitrate,
78 scoped_ptr<EncodedFrame> encoded_frame); 70 scoped_ptr<EncodedFrame> encoded_frame);
79 71
80 // Encodes media::VideoFrame images into EncodedFrames. Per configuration, 72 // Encodes media::VideoFrame images into EncodedFrames. Per configuration,
81 // this will point to either the internal software-based encoder or a proxy to 73 // this will point to either the internal software-based encoder or a proxy to
82 // a hardware-based encoder. 74 // a hardware-based encoder.
83 scoped_ptr<VideoEncoder> video_encoder_; 75 scoped_ptr<VideoEncoder> video_encoder_;
84 76
85 // The number of frames queued for encoding, but not yet sent. 77 // The number of frames queued for encoding, but not yet sent.
(...skipping 15 matching lines...) Expand all
101 // NOTE: Weak pointers must be invalidated before all other member variables. 93 // NOTE: Weak pointers must be invalidated before all other member variables.
102 base::WeakPtrFactory<VideoSender> weak_factory_; 94 base::WeakPtrFactory<VideoSender> weak_factory_;
103 95
104 DISALLOW_COPY_AND_ASSIGN(VideoSender); 96 DISALLOW_COPY_AND_ASSIGN(VideoSender);
105 }; 97 };
106 98
107 } // namespace cast 99 } // namespace cast
108 } // namespace media 100 } // namespace media
109 101
110 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ 102 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698