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

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

Issue 981423002: Remove mojo::DemuxerStreamObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 <queue> 8 #include <queue>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "media/base/audio_decoder_config.h" 11 #include "media/base/audio_decoder_config.h"
12 #include "media/base/demuxer_stream.h" 12 #include "media/base/demuxer_stream.h"
13 #include "media/base/video_decoder_config.h" 13 #include "media/base/video_decoder_config.h"
14 #include "media/mojo/interfaces/demuxer_stream.mojom.h" 14 #include "media/mojo/interfaces/demuxer_stream.mojom.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 // This class acts as a MojoRendererService-side stub for a real DemuxerStream 18 // This class acts as a MojoRendererService-side stub for a real DemuxerStream
19 // that is part of a Pipeline in a remote application. Roughly speaking, it 19 // that is part of a Pipeline in a remote application. Roughly speaking, it
20 // takes a mojo::DemuxerStreamPtr and exposes it as a DemuxerStream for use by 20 // takes a mojo::DemuxerStreamPtr and exposes it as a DemuxerStream for use by
21 // media components. 21 // media components.
22 class MojoDemuxerStreamAdapter : public DemuxerStream, 22 class MojoDemuxerStreamAdapter : public DemuxerStream {
23 public mojo::DemuxerStreamObserver {
24 public: 23 public:
25 // |demuxer_stream| is connected to the mojo::DemuxerStream that |this| will 24 // |demuxer_stream| is connected to the mojo::DemuxerStream that |this| will
26 // become the client of. 25 // become the client of.
27 // |stream_ready_cb| will be invoked when |stream| has fully initialized 26 // |stream_ready_cb| will be invoked when |demuxer_stream| has fully
28 // and |this| is ready for use. 27 // initialized and |this| is ready for use.
29 // NOTE: Illegal to call any methods until |stream_ready_cb| is invoked. 28 // NOTE: Illegal to call any methods until |stream_ready_cb| is invoked.
30 MojoDemuxerStreamAdapter(mojo::DemuxerStreamPtr demuxer_stream, 29 MojoDemuxerStreamAdapter(mojo::DemuxerStreamPtr demuxer_stream,
31 const base::Closure& stream_ready_cb); 30 const base::Closure& stream_ready_cb);
32 ~MojoDemuxerStreamAdapter() override; 31 ~MojoDemuxerStreamAdapter() override;
33 32
34 // DemuxerStream implementation. 33 // DemuxerStream implementation.
35 void Read(const ReadCB& read_cb) override; 34 void Read(const ReadCB& read_cb) override;
36 AudioDecoderConfig audio_decoder_config() override; 35 AudioDecoderConfig audio_decoder_config() override;
37 VideoDecoderConfig video_decoder_config() override; 36 VideoDecoderConfig video_decoder_config() override;
38 Type type() const override; 37 Type type() const override;
39 void EnableBitstreamConverter() override; 38 void EnableBitstreamConverter() override;
40 bool SupportsConfigChanges() override; 39 bool SupportsConfigChanges() override;
41 VideoRotation video_rotation() override; 40 VideoRotation video_rotation() override;
42 41
43 // mojo::DemuxerStreamClient implementation. 42 private:
44 void OnAudioDecoderConfigChanged(mojo::AudioDecoderConfigPtr config) override; 43 void OnStreamReady(mojo::DemuxerStream::Type type,
45 void OnVideoDecoderConfigChanged(mojo::VideoDecoderConfigPtr config) override; 44 mojo::ScopedDataPipeConsumerHandle pipe,
45 mojo::AudioDecoderConfigPtr audio_config,
46 mojo::VideoDecoderConfigPtr video_config);
46 47
47 private:
48 // The callback from |demuxer_stream_| that a read operation has completed. 48 // The callback from |demuxer_stream_| that a read operation has completed.
49 // |read_cb| is a callback from the client who invoked Read() on |this|. 49 // |read_cb| is a callback from the client who invoked Read() on |this|.
50 void OnBufferReady(mojo::DemuxerStream::Status status, 50 void OnBufferReady(mojo::DemuxerStream::Status status,
51 mojo::MediaDecoderBufferPtr buffer); 51 mojo::MediaDecoderBufferPtr buffer,
52 mojo::AudioDecoderConfigPtr audio_config,
53 mojo::VideoDecoderConfigPtr video_config);
52 54
53 void OnStreamReady(mojo::ScopedDataPipeConsumerHandle pipe); 55 void UpdateConfig(mojo::AudioDecoderConfigPtr audio_config,
56 mojo::VideoDecoderConfigPtr video_config);
54 57
55 // See constructor for descriptions. 58 // See constructor for descriptions.
56 mojo::DemuxerStreamPtr demuxer_stream_; 59 mojo::DemuxerStreamPtr demuxer_stream_;
57 mojo::Binding<DemuxerStreamObserver> binding_;
58 base::Closure stream_ready_cb_; 60 base::Closure stream_ready_cb_;
59 61
60 // The last ReadCB received through a call to Read(). 62 // The last ReadCB received through a call to Read().
61 // Used to store the results of OnBufferReady() in the event it is called 63 // Used to store the results of OnBufferReady() in the event it is called
62 // with DemuxerStream::Status::kConfigChanged and we don't have an up to 64 // with DemuxerStream::Status::kConfigChanged and we don't have an up to
63 // date AudioDecoderConfig yet. In that case we can't forward the results 65 // date AudioDecoderConfig yet. In that case we can't forward the results
64 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed. 66 // on to the caller of Read() until OnAudioDecoderConfigChanged is observed.
65 DemuxerStream::ReadCB read_cb_; 67 DemuxerStream::ReadCB read_cb_;
66 68
67 // The front of the queue is the current config. We pop when we observe 69 // The current config.
68 // DemuxerStatus::CONFIG_CHANGED. 70 AudioDecoderConfig audio_config_;
69 std::queue<AudioDecoderConfig> audio_config_queue_; 71 VideoDecoderConfig video_config_;
70 std::queue<VideoDecoderConfig> video_config_queue_;
71 72
72 DemuxerStream::Type type_; 73 DemuxerStream::Type type_;
73 74
74 // DataPipe for deserializing the data section of DecoderBuffers from. 75 // DataPipe for deserializing the data section of DecoderBuffers from.
75 mojo::ScopedDataPipeConsumerHandle stream_pipe_; 76 mojo::ScopedDataPipeConsumerHandle stream_pipe_;
76 77
77 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_; 78 base::WeakPtrFactory<MojoDemuxerStreamAdapter> weak_factory_;
78 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter); 79 DISALLOW_COPY_AND_ASSIGN(MojoDemuxerStreamAdapter);
79 }; 80 };
80 81
81 } // namespace media 82 } // namespace media
82 83
83 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_ 84 #endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_STREAM_ADAPTER_H_
OLDNEW
« no previous file with comments | « media/mojo/interfaces/demuxer_stream.mojom ('k') | media/mojo/services/mojo_demuxer_stream_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698