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_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ |
6 #define MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "media/base/video_decoder.h" | 11 #include "media/base/video_decoder.h" |
| 12 #include "media/mojo/clients/mojo_media_log_service.h" |
12 #include "media/mojo/interfaces/video_decoder.mojom.h" | 13 #include "media/mojo/interfaces/video_decoder.mojom.h" |
13 #include "mojo/public/cpp/bindings/associated_binding.h" | 14 #include "mojo/public/cpp/bindings/associated_binding.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class SingleThreadTaskRunner; | 17 class SingleThreadTaskRunner; |
17 } | 18 } |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 | 21 |
21 class GpuVideoAcceleratorFactories; | 22 class GpuVideoAcceleratorFactories; |
| 23 class MediaLog; |
22 class MojoDecoderBufferWriter; | 24 class MojoDecoderBufferWriter; |
23 | 25 |
24 // A VideoDecoder, for use in the renderer process, that proxies to a | 26 // A VideoDecoder, for use in the renderer process, that proxies to a |
25 // mojom::VideoDecoder. It is assumed that the other side will be implemented by | 27 // mojom::VideoDecoder. It is assumed that the other side will be implemented by |
26 // MojoVideoDecoderService, running in the GPU process, and that the remote | 28 // MojoVideoDecoderService, running in the GPU process, and that the remote |
27 // decoder will be hardware accelerated. | 29 // decoder will be hardware accelerated. |
28 class MojoVideoDecoder final : public VideoDecoder, | 30 class MojoVideoDecoder final : public VideoDecoder, |
29 public mojom::VideoDecoderClient { | 31 public mojom::VideoDecoderClient { |
30 public: | 32 public: |
31 MojoVideoDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 33 MojoVideoDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
32 GpuVideoAcceleratorFactories* gpu_factories, | 34 GpuVideoAcceleratorFactories* gpu_factories, |
| 35 MediaLog* media_log, |
33 mojom::VideoDecoderPtr remote_decoder); | 36 mojom::VideoDecoderPtr remote_decoder); |
34 ~MojoVideoDecoder() final; | 37 ~MojoVideoDecoder() final; |
35 | 38 |
36 // VideoDecoder implementation. | 39 // VideoDecoder implementation. |
37 std::string GetDisplayName() const final; | 40 std::string GetDisplayName() const final; |
38 void Initialize(const VideoDecoderConfig& config, | 41 void Initialize(const VideoDecoderConfig& config, |
39 bool low_delay, | 42 bool low_delay, |
40 CdmContext* cdm_context, | 43 CdmContext* cdm_context, |
41 const InitCB& init_cb, | 44 const InitCB& init_cb, |
42 const OutputCB& output_cb) final; | 45 const OutputCB& output_cb) final; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 InitCB init_cb_; | 83 InitCB init_cb_; |
81 OutputCB output_cb_; | 84 OutputCB output_cb_; |
82 uint64_t decode_counter_ = 0; | 85 uint64_t decode_counter_ = 0; |
83 std::map<uint64_t, DecodeCB> pending_decodes_; | 86 std::map<uint64_t, DecodeCB> pending_decodes_; |
84 base::Closure reset_cb_; | 87 base::Closure reset_cb_; |
85 | 88 |
86 mojom::VideoDecoderPtr remote_decoder_; | 89 mojom::VideoDecoderPtr remote_decoder_; |
87 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; | 90 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; |
88 bool remote_decoder_bound_ = false; | 91 bool remote_decoder_bound_ = false; |
89 bool has_connection_error_ = false; | 92 bool has_connection_error_ = false; |
90 mojo::AssociatedBinding<VideoDecoderClient> client_binding_; | 93 mojo::AssociatedBinding<mojom::VideoDecoderClient> client_binding_; |
| 94 MojoMediaLogService media_log_service_; |
| 95 mojo::AssociatedBinding<mojom::MediaLog> media_log_binding_; |
91 | 96 |
92 bool initialized_ = false; | 97 bool initialized_ = false; |
93 bool needs_bitstream_conversion_ = false; | 98 bool needs_bitstream_conversion_ = false; |
94 bool can_read_without_stalling_ = true; | 99 bool can_read_without_stalling_ = true; |
95 int32_t max_decode_requests_ = 1; | 100 int32_t max_decode_requests_ = 1; |
96 | 101 |
97 base::WeakPtr<MojoVideoDecoder> weak_this_; | 102 base::WeakPtr<MojoVideoDecoder> weak_this_; |
98 base::WeakPtrFactory<MojoVideoDecoder> weak_factory_; | 103 base::WeakPtrFactory<MojoVideoDecoder> weak_factory_; |
99 | 104 |
100 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); | 105 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); |
101 }; | 106 }; |
102 | 107 |
103 } // namespace media | 108 } // namespace media |
104 | 109 |
105 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ | 110 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ |
OLD | NEW |