Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / media / cast / video_sender / video_encoder.h
blob09a5b293dfb7c25d1aea499bc58381d3fbe6e4b3
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_
6 #define MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h"
13 #include "media/base/video_frame.h"
14 #include "media/cast/cast_config.h"
15 #include "media/cast/cast_environment.h"
17 namespace media {
18 namespace cast {
20 // All these functions are called from the main cast thread.
21 class VideoEncoder {
22 public:
23 typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>,
24 const base::TimeTicks&)> FrameEncodedCallback;
26 virtual ~VideoEncoder() {}
28 // The video_frame must be valid until the closure callback is called.
29 // The closure callback is called from the video encoder thread as soon as
30 // the encoder is done with the frame; it does not mean that the encoded frame
31 // has been sent out.
32 // Once the encoded frame is ready the frame_encoded_callback is called.
33 virtual bool EncodeVideoFrame(
34 const scoped_refptr<media::VideoFrame>& video_frame,
35 const base::TimeTicks& capture_time,
36 const FrameEncodedCallback& frame_encoded_callback) = 0;
38 // Inform the encoder about the new target bit rate.
39 virtual void SetBitRate(int new_bit_rate) = 0;
41 // Inform the encoder to not encode the next frame.
42 // Note: this setting is sticky and should last until called with false.
43 virtual void SkipNextFrame(bool skip_next_frame) = 0;
45 // Inform the encoder to encode the next frame as a key frame.
46 virtual void GenerateKeyFrame() = 0;
48 // Inform the encoder to only reference frames older or equal to frame_id;
49 virtual void LatestFrameIdToReference(uint32 frame_id) = 0;
51 // Query the codec about how many frames it has skipped due to slow ACK.
52 virtual int NumberOfSkippedFrames() const = 0;
55 } // namespace cast
56 } // namespace media
58 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_