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

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: Created 4 years, 8 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
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 an interfaces::VideoDecoder. 21 // A VideoDecoder that proxies to an interfaces::VideoDecoder.
19 class MojoVideoDecoder : public VideoDecoder { 22 class MojoVideoDecoder : public VideoDecoder,
23 public interfaces::VideoDecoderClient {
20 public: 24 public:
21 MojoVideoDecoder(); 25 MojoVideoDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
26 interfaces::VideoDecoderPtr remote_decoder);
22 ~MojoVideoDecoder() final; 27 ~MojoVideoDecoder() final;
23 28
24 // VideoDecoder implementation. 29 // VideoDecoder implementation.
25 std::string GetDisplayName() const final; 30 std::string GetDisplayName() const final;
26 void Initialize(const VideoDecoderConfig& config, 31 void Initialize(const VideoDecoderConfig& config,
27 bool low_delay, 32 bool low_delay,
28 CdmContext* cdm_context, 33 CdmContext* cdm_context,
29 const InitCB& init_cb, 34 const InitCB& init_cb,
30 const OutputCB& output_cb) final; 35 const OutputCB& output_cb) final;
31 void Decode(const scoped_refptr<DecoderBuffer>& buffer, 36 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
32 const DecodeCB& decode_cb) final; 37 const DecodeCB& decode_cb) final;
33 void Reset(const base::Closure& closure) final; 38 void Reset(const base::Closure& closure) final;
34 bool NeedsBitstreamConversion() const final; 39 bool NeedsBitstreamConversion() const final;
35 bool CanReadWithoutStalling() const final; 40 bool CanReadWithoutStalling() const final;
36 int GetMaxDecodeRequests() const final; 41 int GetMaxDecodeRequests() const final;
37 42
43 // interfaces::VideoDecoderClient implementation.
44 void OnOutput(interfaces::VideoFramePtr frame) final;
45
38 private: 46 private:
47 void OnInitialized();
48 void OnDecoded(interfaces::DecodeStatus status);
49 void OnReset();
50
51 void OnConnectionError();
52 void BindRemoteDecoder();
53
39 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 54 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
40 55
56 // Used to pass the remote decoder from the constructor (on the main thread)
57 // to Initialize() (on the media thread).
58 interfaces::VideoDecoderPtrInfo remote_decoder_info_;
59
60 bool has_connection_error_ = false;
61 InitCB init_cb_;
62 OutputCB output_cb_;
63 DecodeCB decode_cb_;
64 base::Closure reset_cb_;
65
66 interfaces::VideoDecoderPtr remote_decoder_;
67 bool remote_decoder_bound_ = false;
68 mojo::ScopedDataPipeProducerHandle decoder_buffer_producer_;
69 mojo::Binding<VideoDecoderClient> binding_;
70
41 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); 71 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder);
42 }; 72 };
43 73
44 } // namespace media 74 } // namespace media
45 75
46 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_H_ 76 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698