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 "media/base/video_decoder.h" | 10 #include "media/base/video_decoder.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 const DecodeCB& decode_cb) final; | 43 const DecodeCB& decode_cb) final; |
44 void Reset(const base::Closure& closure) final; | 44 void Reset(const base::Closure& closure) final; |
45 bool NeedsBitstreamConversion() const final; | 45 bool NeedsBitstreamConversion() const final; |
46 bool CanReadWithoutStalling() const final; | 46 bool CanReadWithoutStalling() const final; |
47 int GetMaxDecodeRequests() const final; | 47 int GetMaxDecodeRequests() const final; |
48 | 48 |
49 // mojom::VideoDecoderClient implementation. | 49 // mojom::VideoDecoderClient implementation. |
50 void OnVideoFrameDecoded(mojom::VideoFramePtr frame) final; | 50 void OnVideoFrameDecoded(mojom::VideoFramePtr frame) final; |
51 | 51 |
52 private: | 52 private: |
53 void OnInitializeDone(bool status); | 53 void OnInitializeDone(bool status, |
54 void OnDecodeDone(DecodeStatus status); | 54 bool needs_bitstream_conversion, |
55 int32_t max_decode_requests); | |
56 void OnDecodeDone(uint64_t decode_id, | |
57 DecodeStatus status, | |
58 bool can_read_without_stalling); | |
55 void OnResetDone(); | 59 void OnResetDone(); |
56 | 60 |
57 void BindRemoteDecoder(); | 61 void BindRemoteDecoder(); |
58 void OnConnectionError(); | 62 |
63 // Cleans up callbacks and blocks future calls. | |
64 void Stop(); | |
59 | 65 |
60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 66 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
61 GpuVideoAcceleratorFactories* gpu_factories_; | 67 GpuVideoAcceleratorFactories* gpu_factories_; |
62 | 68 |
63 // Used to pass the remote decoder from the constructor (on the main thread) | 69 // Used to pass the remote decoder from the constructor (on the main thread) |
64 // to Initialize() (on the media thread). | 70 // to Initialize() (on the media thread). |
65 mojom::VideoDecoderPtrInfo remote_decoder_info_; | 71 mojom::VideoDecoderPtrInfo remote_decoder_info_; |
66 | 72 |
67 InitCB init_cb_; | 73 InitCB init_cb_; |
68 OutputCB output_cb_; | 74 OutputCB output_cb_; |
69 DecodeCB decode_cb_; | 75 uint64_t decode_counter_ = 0; |
76 std::map<uint64_t, DecodeCB> pending_decodes_; | |
70 base::Closure reset_cb_; | 77 base::Closure reset_cb_; |
71 | 78 |
72 mojom::VideoDecoderPtr remote_decoder_; | 79 mojom::VideoDecoderPtr remote_decoder_; |
73 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; | 80 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; |
74 bool remote_decoder_bound_ = false; | 81 bool remote_decoder_bound_ = false; |
75 bool has_connection_error_ = false; | 82 bool has_connection_error_ = false; |
76 mojo::AssociatedBinding<VideoDecoderClient> client_binding_; | 83 mojo::AssociatedBinding<VideoDecoderClient> client_binding_; |
77 | 84 |
85 bool initialized_ = false; | |
86 bool needs_bitstream_conversion_ = false; | |
87 bool max_decode_requests_ = 1; | |
dcheng
2016/10/18 20:39:05
bool?
sandersd (OOO until July 31)
2016/10/19 18:28:30
Done.
| |
88 bool can_read_without_stalling_ = true; | |
89 | |
78 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); | 90 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); |
79 }; | 91 }; |
80 | 92 |
81 } // namespace media | 93 } // namespace media |
82 | 94 |
83 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ | 95 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ |
OLD | NEW |