Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: media/mojo/services/mojo_video_decoder.h

Issue 1899363002: Finish plumbing MojoVideoDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows needs some more headers, apaprently. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/mojo/services/mojo_media_client.cc ('k') | media/mojo/services/mojo_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SERVICES_MOJO_VIDEO_DECODER_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_H_ 6 #define MEDIA_MOJO_SERVICES_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"
11 #include "media/mojo/interfaces/video_decoder.mojom.h"
12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "mojo/public/cpp/system/data_pipe.h"
11 14
12 namespace base { 15 namespace base {
13 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
14 } 17 }
15 18
16 namespace media { 19 namespace media {
17 20
18 // A VideoDecoder that proxies to a mojom::VideoDecoder. 21 class GpuVideoAcceleratorFactories;
19 class MojoVideoDecoder : public VideoDecoder { 22
23 // A VideoDecoder, for use in the renderer process, that proxies to a
24 // mojom::VideoDecoder. It is assumed that the other side will be implemented by
25 // MojoVideoDecoderService, running in the GPU process, and that the remote
26 // decoder will be hardware accelerated.
27 class MojoVideoDecoder final : public VideoDecoder,
28 public mojom::VideoDecoderClient {
20 public: 29 public:
21 MojoVideoDecoder(); 30 MojoVideoDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
31 GpuVideoAcceleratorFactories* gpu_factories,
32 mojom::VideoDecoderPtr remote_decoder);
22 ~MojoVideoDecoder() final; 33 ~MojoVideoDecoder() final;
23 34
24 // VideoDecoder implementation. 35 // VideoDecoder implementation.
25 std::string GetDisplayName() const final; 36 std::string GetDisplayName() const final;
26 void Initialize(const VideoDecoderConfig& config, 37 void Initialize(const VideoDecoderConfig& config,
27 bool low_delay, 38 bool low_delay,
28 CdmContext* cdm_context, 39 CdmContext* cdm_context,
29 const InitCB& init_cb, 40 const InitCB& init_cb,
30 const OutputCB& output_cb) final; 41 const OutputCB& output_cb) final;
31 void Decode(const scoped_refptr<DecoderBuffer>& buffer, 42 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
32 const DecodeCB& decode_cb) final; 43 const DecodeCB& decode_cb) final;
33 void Reset(const base::Closure& closure) final; 44 void Reset(const base::Closure& closure) final;
34 bool NeedsBitstreamConversion() const final; 45 bool NeedsBitstreamConversion() const final;
35 bool CanReadWithoutStalling() const final; 46 bool CanReadWithoutStalling() const final;
36 int GetMaxDecodeRequests() const final; 47 int GetMaxDecodeRequests() const final;
37 48
49 // mojom::VideoDecoderClient implementation.
50 void OnVideoFrameDecoded(mojom::VideoFramePtr frame) final;
51
38 private: 52 private:
53 void OnInitializeDone(bool status);
54 void OnDecodeDone(mojom::DecodeStatus status);
55 void OnResetDone();
56
57 void BindRemoteDecoder();
58 void OnConnectionError();
59
39 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
61 GpuVideoAcceleratorFactories* gpu_factories_;
62
63 // Used to pass the remote decoder from the constructor (on the main thread)
64 // to Initialize() (on the media thread).
65 mojom::VideoDecoderPtrInfo remote_decoder_info_;
66
67 InitCB init_cb_;
68 OutputCB output_cb_;
69 DecodeCB decode_cb_;
70 base::Closure reset_cb_;
71
72 mojom::VideoDecoderPtr remote_decoder_;
73 mojo::ScopedDataPipeProducerHandle decoder_buffer_pipe_;
74 bool remote_decoder_bound_ = false;
75 bool has_connection_error_ = false;
76 mojo::Binding<VideoDecoderClient> binding_;
40 77
41 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); 78 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder);
42 }; 79 };
43 80
44 } // namespace media 81 } // namespace media
45 82
46 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_H_ 83 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_media_client.cc ('k') | media/mojo/services/mojo_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698