Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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. | |
| 4 | |
| 5 #ifndef SERVICES_MEDIA_AUDIO_AUDIO_TRACK_IMPL_H_ | |
| 6 #define SERVICES_MEDIA_AUDIO_AUDIO_TRACK_IMPL_H_ | |
| 7 | |
| 8 #include <deque> | |
| 9 #include <set> | |
| 10 | |
| 11 #include "base/synchronization/lock.h" | |
| 12 #include "mojo/public/cpp/bindings/binding.h" | |
| 13 #include "mojo/public/cpp/bindings/callback.h" | |
| 14 #include "mojo/services/media/audio/interfaces/audio_track.mojom.h" | |
| 15 #include "mojo/services/media/common/cpp/linear_transform.h" | |
| 16 #include "services/media/audio/audio_pipe.h" | |
| 17 #include "services/media/audio/fwd_decls.h" | |
| 18 #include "services/media/common/rate_control_base.h" | |
| 19 | |
| 20 namespace mojo { | |
| 21 namespace media { | |
| 22 namespace audio { | |
| 23 | |
| 24 class AudioTrackImpl : public AudioTrack { | |
| 25 public: | |
| 26 // TODO(johngro): Find a better place for this constant. It affects the | |
| 27 // behavior of more than just the Audio Track implementation. | |
| 28 static constexpr size_t PTS_FRACTIONAL_BITS = 12; | |
|
jeffbrown
2015/11/04 23:43:33
Maybe make a new fixed point datatype instead.
johngro
2015/11/06 02:20:26
perhaps, but I would rather not at the moment. I
| |
| 29 | |
| 30 ~AudioTrackImpl() override; | |
| 31 static AudioTrackImplPtr Create(InterfaceRequest<AudioTrack> iface, | |
| 32 AudioServerImpl* owner); | |
| 33 | |
| 34 // Implementation of AudioTrack interface. | |
| 35 void Describe(const DescribeCallback& cbk) override; | |
|
jeffbrown
2015/11/04 23:43:33
These should be private.
johngro
2015/11/06 02:20:26
Done.
| |
| 36 void Configure(AudioTrackConfigurationPtr configuration, | |
| 37 InterfaceRequest<MediaPipe> req, | |
| 38 const ConfigureCallback& cbk) override; | |
| 39 void GetRateControl(InterfaceRequest<RateControl> req, | |
| 40 const GetRateControlCallback& cbk) override; | |
| 41 | |
| 42 // Methods used by the output manager to link this track to different outputs. | |
| 43 void AddOutput(AudioTrackToOutputLinkPtr link); | |
| 44 void RemoveOutput(AudioTrackToOutputLinkPtr link); | |
| 45 | |
| 46 // Accessors used by AudioOutputs during mixing to access parameters which are | |
| 47 // important for the mixing process. | |
| 48 void SnapshotRateTrans(LinearTransform* out, uint32_t* generation = nullptr) { | |
| 49 rate_control_.SnapshotCurrentTransform(out, generation); | |
| 50 } | |
| 51 | |
| 52 const LinearTransform::Ratio& FractionalFrameToMediaTimeRatio() const { | |
| 53 return frame_to_media_ratio_; | |
| 54 } | |
| 55 | |
| 56 uint32_t BytesPerFrame() const { return bytes_per_frame_; } | |
| 57 const LpcmMediaTypeDetailsPtr& Format() const { return format_; } | |
| 58 | |
| 59 private: | |
| 60 friend class AudioPipe; | |
| 61 | |
| 62 AudioTrackImpl(InterfaceRequest<AudioTrack> track, | |
| 63 AudioServerImpl* owner); | |
| 64 | |
| 65 void OnPacketReceived(AudioPipe::AudioPacketRefPtr packet); | |
| 66 void OnFlushRequested(const MediaPipe::FlushCallback& cbk); | |
| 67 | |
| 68 AudioTrackImplWeakPtr weak_this_; | |
|
jeffbrown
2015/11/04 23:43:33
Using lots of typedefs makes it harder to understa
johngro
2015/11/06 02:20:26
I'm not sure of exactly what you are concerned abo
| |
| 69 AudioServerImpl* owner_; | |
| 70 Binding<AudioTrack> binding_; | |
|
jeffbrown
2015/11/04 23:43:33
alignment is a little wonky here
More importantly
johngro
2015/11/06 02:20:26
yeah, this happened because of the global rename f
| |
| 71 AudioPipe pipe_; | |
| 72 RateControlBase rate_control_; | |
| 73 LinearTransform::Ratio frame_to_media_ratio_; | |
| 74 uint32_t bytes_per_frame_ = 1; | |
| 75 LpcmMediaTypeDetailsPtr format_; | |
| 76 AudioTrackToOutputLinkSet outputs_; | |
| 77 }; | |
| 78 | |
| 79 } // namespace audio | |
| 80 } // namespace media | |
| 81 } // namespace mojo | |
| 82 | |
| 83 #endif // SERVICES_MEDIA_AUDIO_AUDIO_TRACK_IMPL_H_ | |
| OLD | NEW |