Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / media / cast / sender / audio_encoder.h
blob61ac08b36fa4a496140554a9a0eee7815dd3b426
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_SENDER_AUDIO_ENCODER_H_
6 #define MEDIA_CAST_SENDER_AUDIO_ENCODER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/threading/thread_checker.h"
11 #include "media/base/audio_bus.h"
12 #include "media/cast/cast_environment.h"
13 #include "media/cast/sender/sender_encoded_frame.h"
15 namespace base {
16 class TimeTicks;
19 namespace media {
20 namespace cast {
22 class AudioEncoder {
23 public:
24 // Callback to deliver each SenderEncodedFrame, plus the number of audio
25 // samples skipped since the last frame.
26 using FrameEncodedCallback =
27 base::Callback<void(scoped_ptr<SenderEncodedFrame>, int)>;
29 AudioEncoder(const scoped_refptr<CastEnvironment>& cast_environment,
30 int num_channels,
31 int sampling_rate,
32 int bitrate,
33 Codec codec,
34 const FrameEncodedCallback& frame_encoded_callback);
35 virtual ~AudioEncoder();
37 OperationalStatus InitializationResult() const;
39 int GetSamplesPerFrame() const;
40 base::TimeDelta GetFrameDuration() const;
42 void InsertAudio(scoped_ptr<AudioBus> audio_bus,
43 const base::TimeTicks& recorded_time);
45 private:
46 class ImplBase;
47 class OpusImpl;
48 class Pcm16Impl;
49 class AppleAacImpl;
51 const scoped_refptr<CastEnvironment> cast_environment_;
52 scoped_refptr<ImplBase> impl_;
54 // Used to ensure only one thread invokes InsertAudio().
55 base::ThreadChecker insert_thread_checker_;
57 DISALLOW_COPY_AND_ASSIGN(AudioEncoder);
60 } // namespace cast
61 } // namespace media
63 #endif // MEDIA_CAST_SENDER_AUDIO_ENCODER_H_