| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMECAST_MEDIA_CMA_IPC_STREAMER_CODED_FRAME_PROVIDER_HOST_H_ | |
| 6 #define CHROMECAST_MEDIA_CMA_IPC_STREAMER_CODED_FRAME_PROVIDER_HOST_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "base/threading/thread_checker.h" | |
| 14 #include "chromecast/media/cma/base/coded_frame_provider.h" | |
| 15 #include "media/base/audio_decoder_config.h" | |
| 16 #include "media/base/video_decoder_config.h" | |
| 17 | |
| 18 namespace chromecast { | |
| 19 namespace media { | |
| 20 class MediaMessageFifo; | |
| 21 | |
| 22 // CodedFrameProviderHost is a frame provider that gets the frames | |
| 23 // from a media message fifo. | |
| 24 class CodedFrameProviderHost : public CodedFrameProvider { | |
| 25 public: | |
| 26 // Note: if the media message fifo is located into shared memory, | |
| 27 // the caller must make sure the shared memory segment is valid | |
| 28 // during the whole lifetime of this object. | |
| 29 explicit CodedFrameProviderHost( | |
| 30 std::unique_ptr<MediaMessageFifo> media_message_fifo); | |
| 31 ~CodedFrameProviderHost() override; | |
| 32 | |
| 33 // CodedFrameProvider implementation. | |
| 34 void Read(const ReadCB& read_cb) override; | |
| 35 void Flush(const base::Closure& flush_cb) override; | |
| 36 | |
| 37 // Invoked when some data has been written into the fifo. | |
| 38 void OnFifoWriteEvent(); | |
| 39 base::Closure GetFifoWriteEventCb(); | |
| 40 | |
| 41 private: | |
| 42 void ReadMessages(); | |
| 43 | |
| 44 base::ThreadChecker thread_checker_; | |
| 45 | |
| 46 // Fifo holding the frames. | |
| 47 std::unique_ptr<MediaMessageFifo> fifo_; | |
| 48 | |
| 49 ReadCB read_cb_; | |
| 50 | |
| 51 // Audio/video configuration for the next A/V buffer. | |
| 52 ::media::AudioDecoderConfig audio_config_; | |
| 53 ::media::VideoDecoderConfig video_config_; | |
| 54 | |
| 55 base::WeakPtr<CodedFrameProviderHost> weak_this_; | |
| 56 base::WeakPtrFactory<CodedFrameProviderHost> weak_factory_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(CodedFrameProviderHost); | |
| 59 }; | |
| 60 | |
| 61 } // namespace media | |
| 62 } // namespace chromecast | |
| 63 | |
| 64 #endif // CHROMECAST_MEDIA_CMA_IPC_STREAMER_CODED_FRAME_PROVIDER_HOST_H_ | |
| OLD | NEW |