| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 SERVICES_MEDIA_AUDIO_AUDIO_PIPE_H_ | 5 #ifndef SERVICES_MEDIA_AUDIO_AUDIO_PIPE_H_ |
| 6 #define SERVICES_MEDIA_AUDIO_AUDIO_PIPE_H_ | 6 #define SERVICES_MEDIA_AUDIO_AUDIO_PIPE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // TODO(johngro): Reconsider this. It may be best to keep things expressed | 51 // TODO(johngro): Reconsider this. It may be best to keep things expressed |
| 52 // simply in media time instead of converting to fractional units of track | 52 // simply in media time instead of converting to fractional units of track |
| 53 // frames. If/when outputs move away from a single fixed step size for | 53 // frames. If/when outputs move away from a single fixed step size for |
| 54 // output sampling, it will probably be best to just convert this back to | 54 // output sampling, it will probably be best to just convert this back to |
| 55 // media time. | 55 // media time. |
| 56 const int64_t& start_pts() const { return start_pts_; } | 56 const int64_t& start_pts() const { return start_pts_; } |
| 57 const int64_t& end_pts() const { return end_pts_; } | 57 const int64_t& end_pts() const { return end_pts_; } |
| 58 | 58 |
| 59 // Accessor for the regions in the shared buffer which contain the actual | 59 // Accessor for the regions in the shared buffer which contain the actual |
| 60 // sample data. | 60 // sample data. |
| 61 const std::vector<Region>& regions() const { return regions_; } | 61 const std::vector<Region>& regions() const { return regions_; } |
| 62 |
| 63 uint32_t frame_count() const { return frame_count_; } |
| 64 const MediaPacketStatePtr& state() const { return state_; } |
| 62 | 65 |
| 63 private: | 66 private: |
| 64 friend class AudioPipe; | 67 friend class AudioPipe; |
| 65 AudioPacketRef(MediaPacketStatePtr state, | 68 AudioPacketRef(MediaPacketStatePtr state, |
| 66 AudioServerImpl* server, | 69 AudioServerImpl* server, |
| 67 std::vector<Region>&& regions, // NOLINT(build/c++11) | 70 std::vector<Region>&& regions, // NOLINT(build/c++11) |
| 68 int64_t start_pts, | 71 int64_t start_pts, |
| 69 int64_t end_pts); | 72 int64_t end_pts, |
| 73 uint32_t frame_count); |
| 70 | 74 |
| 71 MediaPacketStatePtr state_; | 75 MediaPacketStatePtr state_; |
| 72 AudioServerImpl* server_; | 76 AudioServerImpl* server_; |
| 73 | 77 |
| 74 std::vector<Region> regions_; | 78 std::vector<Region> regions_; |
| 75 int64_t start_pts_; | 79 int64_t start_pts_; |
| 76 int64_t end_pts_; | 80 int64_t end_pts_; |
| 81 uint32_t frame_count_; |
| 77 }; | 82 }; |
| 78 | 83 |
| 79 AudioPipe(AudioTrackImpl* owner, AudioServerImpl* server); | 84 AudioPipe(AudioTrackImpl* owner, AudioServerImpl* server); |
| 80 ~AudioPipe() override; | 85 ~AudioPipe() override; |
| 81 | 86 |
| 82 protected: | 87 protected: |
| 83 void OnPacketReceived(MediaPacketStatePtr state) override; | 88 void OnPacketReceived(MediaPacketStatePtr state) override; |
| 84 void OnPrimeRequested(const PrimeCallback& cbk) override; | 89 void OnPrimeRequested(const PrimeCallback& cbk) override; |
| 85 bool OnFlushRequested(const FlushCallback& cbk) override; | 90 bool OnFlushRequested(const FlushCallback& cbk) override; |
| 86 | 91 |
| 87 private: | 92 private: |
| 88 AudioTrackImpl* owner_; | 93 AudioTrackImpl* owner_; |
| 89 AudioServerImpl* server_; | 94 AudioServerImpl* server_; |
| 90 | 95 |
| 91 // State used for timestamp interpolation | 96 // State used for timestamp interpolation |
| 92 bool next_pts_known_ = 0; | 97 bool next_pts_known_ = 0; |
| 93 int64_t next_pts_; | 98 int64_t next_pts_; |
| 94 | 99 |
| 95 PrimeCallback prime_callback_; | 100 PrimeCallback prime_callback_; |
| 96 }; | 101 }; |
| 97 | 102 |
| 98 } // namespace audio | 103 } // namespace audio |
| 99 } // namespace media | 104 } // namespace media |
| 100 } // namespace mojo | 105 } // namespace mojo |
| 101 | 106 |
| 102 #endif // SERVICES_MEDIA_AUDIO_AUDIO_PIPE_H_ | 107 #endif // SERVICES_MEDIA_AUDIO_AUDIO_PIPE_H_ |
| OLD | NEW |