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

Unified Diff: chromecast/media/cma/ipc_streamer/coded_frame_provider_host.h

Issue 557333003: Audio/video data streaming over shared memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comments from patch set #1. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/media/cma/ipc_streamer/coded_frame_provider_host.h
diff --git a/chromecast/media/cma/ipc_streamer/coded_frame_provider_host.h b/chromecast/media/cma/ipc_streamer/coded_frame_provider_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..3dcd329259d8a341feab9dba8b9a4052ac091e3c
--- /dev/null
+++ b/chromecast/media/cma/ipc_streamer/coded_frame_provider_host.h
@@ -0,0 +1,61 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_MEDIA_CMA_IPC_STREAMER_CODED_FRAME_PROVIDER_HOST_H_
+#define CHROMECAST_MEDIA_CMA_IPC_STREAMER_CODED_FRAME_PROVIDER_HOST_H_
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "chromecast/media/cma/base/coded_frame_provider.h"
+#include "media/base/audio_decoder_config.h"
+#include "media/base/video_decoder_config.h"
+
+namespace chromecast {
+namespace media {
+class MediaMessageFifo;
+
+// CodedFrameProviderHost is a frame provider that gets the frames
+// from a media message fifo.
+class CodedFrameProviderHost : public CodedFrameProvider {
+ public:
+ // Note: if the media message fifo is located into shared memory,
+ // the caller must make sure the shared memory segment is valid
+ // during the whole lifetime of this object.
+ explicit CodedFrameProviderHost(
+ scoped_ptr<MediaMessageFifo> media_message_fifo);
+ virtual ~CodedFrameProviderHost();
+
+ // CodedFrameProvider implementation.
+ virtual void Read(const ReadCB& read_cb) OVERRIDE;
+ virtual void Flush(const base::Closure& flush_cb) OVERRIDE;
+
+ // Invoked when some data has been written into the fifo.
+ void OnFifoWriteEvent();
+ base::Closure GetFifoWriteEventCb();
+
+ private:
+ void ReadMessages();
+
+ base::ThreadChecker thread_checker_;
+
+ // Fifo holding the frames.
+ scoped_ptr<MediaMessageFifo> fifo_;
+
+ ReadCB read_cb_;
+
+ // Audio/video configuration for the next A/V buffer.
+ ::media::AudioDecoderConfig audio_config_;
+ ::media::VideoDecoderConfig video_config_;
+
+ base::WeakPtrFactory<CodedFrameProviderHost> weak_factory_;
+ base::WeakPtr<CodedFrameProviderHost> weak_this_;
+
+ DISALLOW_COPY_AND_ASSIGN(CodedFrameProviderHost);
+};
+
+} // namespace media
+} // namespace chromecast
+
+#endif // CHROMECAST_MEDIA_CMA_IPC_STREAMER_CODED_FRAME_PROVIDER_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698