| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_REMOTING_DEMUXER_STREAM_ADAPTER_H_ | 5 #ifndef MEDIA_REMOTING_DEMUXER_STREAM_ADAPTER_H_ |
| 6 #define MEDIA_REMOTING_DEMUXER_STREAM_ADAPTER_H_ | 6 #define MEDIA_REMOTING_DEMUXER_STREAM_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/optional.h" | 16 #include "base/optional.h" |
| 17 #include "media/base/audio_decoder_config.h" | 17 #include "media/base/audio_decoder_config.h" |
| 18 #include "media/base/demuxer_stream.h" | 18 #include "media/base/demuxer_stream.h" |
| 19 #include "media/base/video_decoder_config.h" | 19 #include "media/base/video_decoder_config.h" |
| 20 #include "media/mojo/interfaces/remoting.mojom.h" | 20 #include "media/mojo/interfaces/remoting.mojom.h" |
| 21 #include "media/remoting/rpc_broker.h" | 21 #include "media/remoting/rpc_broker.h" |
| 22 #include "media/remoting/triggers.h" | 22 #include "media/remoting/triggers.h" |
| 23 #include "mojo/public/cpp/system/data_pipe.h" | 23 #include "mojo/public/cpp/system/data_pipe.h" |
| 24 #include "mojo/public/cpp/system/simple_watcher.h" |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace media { | 30 namespace media { |
| 30 | 31 |
| 31 class DemuxerStream; | 32 class DemuxerStream; |
| 32 | 33 |
| 33 namespace remoting { | 34 namespace remoting { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // aborted and data should be discarded when the value is true. | 161 // aborted and data should be discarded when the value is true. |
| 161 bool pending_flush_; | 162 bool pending_flush_; |
| 162 | 163 |
| 163 // Frame buffer and its information that is currently in process of writing to | 164 // Frame buffer and its information that is currently in process of writing to |
| 164 // Mojo data pipe. | 165 // Mojo data pipe. |
| 165 std::vector<uint8_t> pending_frame_; | 166 std::vector<uint8_t> pending_frame_; |
| 166 uint32_t current_pending_frame_offset_; | 167 uint32_t current_pending_frame_offset_; |
| 167 bool pending_frame_is_eos_; | 168 bool pending_frame_is_eos_; |
| 168 | 169 |
| 169 // Monitor if data pipe is available to write data. | 170 // Monitor if data pipe is available to write data. |
| 170 mojo::Watcher write_watcher_; | 171 mojo::SimpleWatcher write_watcher_; |
| 171 | 172 |
| 172 // Keeps latest demuxer stream status and audio/video decoder config. | 173 // Keeps latest demuxer stream status and audio/video decoder config. |
| 173 DemuxerStream::Status media_status_; | 174 DemuxerStream::Status media_status_; |
| 174 AudioDecoderConfig audio_config_; | 175 AudioDecoderConfig audio_config_; |
| 175 VideoDecoderConfig video_config_; | 176 VideoDecoderConfig video_config_; |
| 176 | 177 |
| 177 mojom::RemotingDataStreamSenderPtr stream_sender_; | 178 mojom::RemotingDataStreamSenderPtr stream_sender_; |
| 178 mojo::ScopedDataPipeProducerHandle producer_handle_; | 179 mojo::ScopedDataPipeProducerHandle producer_handle_; |
| 179 | 180 |
| 180 // Tracks the number of bytes written to the pipe. | 181 // Tracks the number of bytes written to the pipe. |
| 181 int64_t bytes_written_to_pipe_; | 182 int64_t bytes_written_to_pipe_; |
| 182 | 183 |
| 183 // WeakPtrFactory only for reading buffer from demuxer stream. This is used | 184 // WeakPtrFactory only for reading buffer from demuxer stream. This is used |
| 184 // for canceling all read callbacks provided to the |demuxer_stream_| before a | 185 // for canceling all read callbacks provided to the |demuxer_stream_| before a |
| 185 // flush. | 186 // flush. |
| 186 base::WeakPtrFactory<DemuxerStreamAdapter> request_buffer_weak_factory_; | 187 base::WeakPtrFactory<DemuxerStreamAdapter> request_buffer_weak_factory_; |
| 187 // WeakPtrFactory for normal usage. | 188 // WeakPtrFactory for normal usage. |
| 188 base::WeakPtrFactory<DemuxerStreamAdapter> weak_factory_; | 189 base::WeakPtrFactory<DemuxerStreamAdapter> weak_factory_; |
| 189 | 190 |
| 190 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamAdapter); | 191 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamAdapter); |
| 191 }; | 192 }; |
| 192 | 193 |
| 193 } // namespace remoting | 194 } // namespace remoting |
| 194 } // namespace media | 195 } // namespace media |
| 195 | 196 |
| 196 #endif // MEDIA_REMOTING_DEMUXER_STREAM_ADAPTER_H_ | 197 #endif // MEDIA_REMOTING_DEMUXER_STREAM_ADAPTER_H_ |
| OLD | NEW |