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

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

Issue 2096063003: media: Add MojoDecoderBuffer{Reader|Writer} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_DEMUXER_STREAM_ADAPTER_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
7 7
8 #include <memory>
8 #include <queue> 9 #include <queue>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "media/base/audio_decoder_config.h" 13 #include "media/base/audio_decoder_config.h"
13 #include "media/base/demuxer_stream.h" 14 #include "media/base/demuxer_stream.h"
14 #include "media/base/video_decoder_config.h" 15 #include "media/base/video_decoder_config.h"
15 #include "media/mojo/interfaces/demuxer_stream.mojom.h" 16 #include "media/mojo/interfaces/demuxer_stream.mojom.h"
16 17
17 namespace media { 18 namespace media {
18 19
20 class MojoDecoderBufferReader;
21
19 // This class acts as a MojoRendererService-side stub for a real DemuxerStream 22 // This class acts as a MojoRendererService-side stub for a real DemuxerStream
20 // that is part of a Pipeline in a remote application. Roughly speaking, it 23 // that is part of a Pipeline in a remote application. Roughly speaking, it
21 // takes a mojom::DemuxerStreamPtr and exposes it as a DemuxerStream for 24 // takes a mojom::DemuxerStreamPtr and exposes it as a DemuxerStream for
22 // use by 25 // use by
23 // media components. 26 // media components.
24 class MojoDemuxerStreamAdapter : public DemuxerStream { 27 class MojoDemuxerStreamAdapter : public DemuxerStream {
25 public: 28 public:
26 // |demuxer_stream| is connected to the mojom::DemuxerStream that |this| 29 // |demuxer_stream| is connected to the mojom::DemuxerStream that |this|
27 // will 30 // will
28 // become the client of. 31 // become the client of.
29 // |stream_ready_cb| will be invoked when |demuxer_stream| has fully 32 // |stream_ready_cb| will be invoked when |demuxer_stream| has fully
30 // initialized and |this| is ready for use. 33 // initialized and |this| is ready for use.
31 // NOTE: Illegal to call any methods until |stream_ready_cb| is invoked. 34 // NOTE: Illegal to call any methods until |stream_ready_cb| is invoked.
32 MojoDemuxerStreamAdapter(mojom::DemuxerStreamPtr demuxer_stream, 35 MojoDemuxerStreamAdapter(mojom::DemuxerStreamPtr demuxer_stream,
33 const base::Closure& stream_ready_cb); 36 const base::Closure& stream_ready_cb);
34 ~MojoDemuxerStreamAdapter() override; 37 ~MojoDemuxerStreamAdapter() override;
35 38
36 // DemuxerStream implementation. 39 // DemuxerStream implementation.
37 void Read(const ReadCB& read_cb) override; 40 void Read(const ReadCB& read_cb) override;
38 AudioDecoderConfig audio_decoder_config() override; 41 AudioDecoderConfig audio_decoder_config() override;
39 VideoDecoderConfig video_decoder_config() override; 42 VideoDecoderConfig video_decoder_config() override;
40 Type type() const override; 43 Type type() const override;
41 void EnableBitstreamConverter() override; 44 void EnableBitstreamConverter() override;
42 bool SupportsConfigChanges() override; 45 bool SupportsConfigChanges() override;
43 VideoRotation video_rotation() override; 46 VideoRotation video_rotation() override;
44 47
45 private: 48 private:
46 void OnStreamReady(mojom::DemuxerStream::Type type, 49 void OnStreamReady(mojom::DemuxerStream::Type type,
47 mojo::ScopedDataPipeConsumerHandle pipe, 50 mojo::ScopedDataPipeConsumerHandle consumer_handle,
48 mojom::AudioDecoderConfigPtr audio_config, 51 mojom::AudioDecoderConfigPtr audio_config,
49 mojom::VideoDecoderConfigPtr video_config); 52 mojom::VideoDecoderConfigPtr video_config);
50 53
51 // The callback from |demuxer_stream_| that a read operation has completed. 54 // The callback from |demuxer_stream_| that a read operation has completed.
52 // |read_cb| is a callback from the client who invoked Read() on |this|. 55 // |read_cb| is a callback from the client who invoked Read() on |this|.
53 void OnBufferReady(mojom::DemuxerStream::Status status, 56 void OnBufferReady(mojom::DemuxerStream::Status status,
54 mojom::DecoderBufferPtr buffer, 57 mojom::DecoderBufferPtr buffer,
55 mojom::AudioDecoderConfigPtr audio_config, 58 mojom::AudioDecoderConfigPtr audio_config,
56 mojom::VideoDecoderConfigPtr video_config); 59 mojom::VideoDecoderConfigPtr video_config);
57 60
(...skipping 10 matching lines...) Expand all
68 // date AudioDecoderConfig yet. In that case we can't forward the results 71 // date AudioDecoderConfig yet. In that case we can't forward the results
69 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed. 72 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed.
70 DemuxerStream::ReadCB read_cb_; 73 DemuxerStream::ReadCB read_cb_;
71 74
72 // The current config. 75 // The current config.
73 AudioDecoderConfig audio_config_; 76 AudioDecoderConfig audio_config_;
74 VideoDecoderConfig video_config_; 77 VideoDecoderConfig video_config_;
75 78
76 DemuxerStream::Type type_; 79 DemuxerStream::Type type_;
77 80
78 // DataPipe for deserializing the data section of DecoderBuffers from. 81 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_;
79 mojo::ScopedDataPipeConsumerHandle stream_pipe_;
80 82
81 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_; 83 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_;
82 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter); 84 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter);
83 }; 85 };
84 86
85 } // namespace media 87 } // namespace media
86 88
87 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ 89 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698