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

Side by Side Diff: media/cast/sender/external_video_encoder.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_EXTERNAL_VIDEO_ENCODER_H_ 5 #ifndef MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
6 #define MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_ 6 #define MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "media/cast/cast_config.h" 10 #include "media/cast/cast_config.h"
11 #include "media/cast/cast_environment.h" 11 #include "media/cast/cast_environment.h"
12 #include "media/cast/sender/video_encoder.h" 12 #include "media/cast/sender/video_encoder.h"
13 #include "media/video/video_encode_accelerator.h" 13 #include "media/video/video_encode_accelerator.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 15
16 namespace media { 16 namespace media {
17 namespace cast { 17 namespace cast {
18 18
19 // Cast MAIN thread proxy to the internal media::VideoEncodeAccelerator 19 // Cast MAIN thread proxy to the internal media::VideoEncodeAccelerator
20 // implementation running on a separate thread. Encodes media::VideoFrames and 20 // implementation running on a separate thread. Encodes media::VideoFrames and
21 // emits media::cast::EncodedFrames. 21 // emits media::cast::EncodedFrames.
22 class ExternalVideoEncoder : public VideoEncoder { 22 class ExternalVideoEncoder : public VideoEncoder {
23 public: 23 public:
24 ExternalVideoEncoder( 24 ExternalVideoEncoder(
25 const scoped_refptr<CastEnvironment>& cast_environment, 25 const scoped_refptr<CastEnvironment>& cast_environment,
26 const VideoSenderConfig& video_config, 26 const VideoSenderConfig& video_config,
27 const gfx::Size& frame_size, 27 const gfx::Size& frame_size,
28 const CastInitializationCallback& initialization_cb, 28 const StatusChangeCallback& status_change_cb,
29 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 29 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
30 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb); 30 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb);
31 31
32 ~ExternalVideoEncoder() override; 32 ~ExternalVideoEncoder() override;
33 33
34 // VideoEncoder implementation. 34 // VideoEncoder implementation.
35 bool CanEncodeVariedFrameSizes() const override; 35 bool CanEncodeVariedFrameSizes() const override;
36 bool EncodeVideoFrame( 36 bool EncodeVideoFrame(
37 const scoped_refptr<media::VideoFrame>& video_frame, 37 const scoped_refptr<media::VideoFrame>& video_frame,
38 const base::TimeTicks& reference_time, 38 const base::TimeTicks& reference_time,
39 const FrameEncodedCallback& frame_encoded_callback) override; 39 const FrameEncodedCallback& frame_encoded_callback) override;
40 void SetBitRate(int new_bit_rate) override; 40 void SetBitRate(int new_bit_rate) override;
41 void GenerateKeyFrame() override; 41 void GenerateKeyFrame() override;
42 void LatestFrameIdToReference(uint32 frame_id) override; 42 void LatestFrameIdToReference(uint32 frame_id) override;
43 43
44 private: 44 private:
45 class VEAClientImpl; 45 class VEAClientImpl;
46 46
47 // Method invoked by the CreateVideoEncodeAcceleratorCallback to construct a 47 // Method invoked by the CreateVideoEncodeAcceleratorCallback to construct a
48 // VEAClientImpl to own and interface with a new |vea|. Upon return, 48 // VEAClientImpl to own and interface with a new |vea|. Upon return,
49 // |client_| holds a reference to the new VEAClientImpl. 49 // |client_| holds a reference to the new VEAClientImpl.
50 void OnCreateVideoEncodeAccelerator( 50 void OnCreateVideoEncodeAccelerator(
51 const gfx::Size& frame_size, 51 const gfx::Size& frame_size,
52 VideoCodecProfile codec_profile, 52 VideoCodecProfile codec_profile,
53 int max_frame_rate, 53 int max_frame_rate,
54 const CastInitializationCallback& initialization_cb, 54 const StatusChangeCallback& status_change_cb,
55 scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner, 55 scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner,
56 scoped_ptr<media::VideoEncodeAccelerator> vea); 56 scoped_ptr<media::VideoEncodeAccelerator> vea);
57 57
58 const scoped_refptr<CastEnvironment> cast_environment_; 58 const scoped_refptr<CastEnvironment> cast_environment_;
59 const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_; 59 const CreateVideoEncodeMemoryCallback create_video_encode_memory_cb_;
60 int bit_rate_; 60 int bit_rate_;
61 bool key_frame_requested_; 61 bool key_frame_requested_;
62 62
63 scoped_refptr<VEAClientImpl> client_; 63 scoped_refptr<VEAClientImpl> client_;
64 64
65 // Provides a weak pointer for the OnCreateVideoEncoderAccelerator() callback. 65 // Provides a weak pointer for the OnCreateVideoEncoderAccelerator() callback.
66 // NOTE: Weak pointers must be invalidated before all other member variables. 66 // NOTE: Weak pointers must be invalidated before all other member variables.
67 base::WeakPtrFactory<ExternalVideoEncoder> weak_factory_; 67 base::WeakPtrFactory<ExternalVideoEncoder> weak_factory_;
68 68
69 DISALLOW_COPY_AND_ASSIGN(ExternalVideoEncoder); 69 DISALLOW_COPY_AND_ASSIGN(ExternalVideoEncoder);
70 }; 70 };
71 71
72 } // namespace cast 72 } // namespace cast
73 } // namespace media 73 } // namespace media
74 74
75 #endif // MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_ 75 #endif // MEDIA_CAST_SENDER_EXTERNAL_VIDEO_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698