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

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

Issue 688423003: [Cast] VideoFrameFactory interface to vend frames with encoder affinity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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_ENCODER_H_ 5 #ifndef MEDIA_CAST_SENDER_VIDEO_ENCODER_H_
6 #define MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ 6 #define MEDIA_CAST_SENDER_VIDEO_ENCODER_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"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
14 #include "media/cast/cast_config.h" 14 #include "media/cast/cast_config.h"
15 #include "media/cast/cast_environment.h" 15 #include "media/cast/cast_environment.h"
16 16
17 namespace media { 17 namespace media {
18 namespace cast { 18 namespace cast {
19 19
20 class VideoFrameFactory;
21
20 // All these functions are called from the main cast thread. 22 // All these functions are called from the main cast thread.
21 class VideoEncoder { 23 class VideoEncoder {
22 public: 24 public:
23 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> FrameEncodedCallback; 25 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> FrameEncodedCallback;
24 26
25 virtual ~VideoEncoder() {} 27 virtual ~VideoEncoder() {}
26 28
27 // If true is returned, the Encoder has accepted the request and will process 29 // If true is returned, the Encoder has accepted the request and will process
28 // it asynchronously, running |frame_encoded_callback| on the MAIN 30 // it asynchronously, running |frame_encoded_callback| on the MAIN
29 // CastEnvironment thread with the result. If false is returned, nothing 31 // CastEnvironment thread with the result. If false is returned, nothing
30 // happens and the callback will not be run. 32 // happens and the callback will not be run.
31 virtual bool EncodeVideoFrame( 33 virtual bool EncodeVideoFrame(
32 const scoped_refptr<media::VideoFrame>& video_frame, 34 const scoped_refptr<media::VideoFrame>& video_frame,
33 const base::TimeTicks& reference_time, 35 const base::TimeTicks& reference_time,
34 const FrameEncodedCallback& frame_encoded_callback) = 0; 36 const FrameEncodedCallback& frame_encoded_callback) = 0;
35 37
36 // Inform the encoder about the new target bit rate. 38 // Inform the encoder about the new target bit rate.
37 virtual void SetBitRate(int new_bit_rate) = 0; 39 virtual void SetBitRate(int new_bit_rate) = 0;
38 40
39 // Inform the encoder to encode the next frame as a key frame. 41 // Inform the encoder to encode the next frame as a key frame.
40 virtual void GenerateKeyFrame() = 0; 42 virtual void GenerateKeyFrame() = 0;
41 43
42 // Inform the encoder to only reference frames older or equal to frame_id; 44 // Inform the encoder to only reference frames older or equal to frame_id;
43 virtual void LatestFrameIdToReference(uint32 frame_id) = 0; 45 virtual void LatestFrameIdToReference(uint32 frame_id) = 0;
46
47 // Allow the encoder to return a specialized video frame factory. May return
48 // null, in which case a default implementation will be used instead.
49 virtual scoped_refptr<VideoFrameFactory> GetVideoFrameFactory() = 0;
Alpha Left Google 2014/11/17 20:23:14 I don't think the threading model for this method
jfroy 2014/11/17 21:23:06 That's not quite the design I had in mind. The ex
Alpha Left Google 2014/11/18 02:57:58 In this patch VideoFrameFactory is always accessed
jfroy 2014/11/18 18:03:59 Sounds good.
44 }; 50 };
45 51
46 } // namespace cast 52 } // namespace cast
47 } // namespace media 53 } // namespace media
48 54
49 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ 55 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698