Index: content/renderer/media/rtc_video_decoder_bridge_tv.h |
diff --git a/content/renderer/media/rtc_video_decoder_bridge_tv.h b/content/renderer/media/rtc_video_decoder_bridge_tv.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..73c4586f1b66f1170713040111385be5fd0566c9 |
--- /dev/null |
+++ b/content/renderer/media/rtc_video_decoder_bridge_tv.h |
@@ -0,0 +1,70 @@ |
+// Copyright (c) 2013 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 CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_ |
+#define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/message_loop_proxy.h" |
+#include "content/common/content_export.h" |
+#include "media/base/audio_decoder_config.h" |
+#include "media/base/decoder_buffer_queue.h" |
+#include "media/base/demuxer.h" |
+#include "media/base/demuxer_stream.h" |
+#include "media/base/pipeline_status.h" |
+#include "media/base/video_decoder_config.h" |
+#include "third_party/webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" |
+ |
+namespace content { |
+ |
+class MediaStreamDependencyFactory; |
+ |
+// A singleton object shared between WebMediaPlayerAndroid and WebRTC Video |
+// Engine. Note that this class provides the first remote stream. |
+// |
+// Example use case: |
+// |
+// // Before using the object: |
+// if (!RTCVideoDecoderBridgeTv::Get()->AcquireOwnership()) |
+// return; |
+// |
+// media::Demuxer demuxer = RTCVideoDecoderBridgeTv::Get()->CreateDemuxer( |
+// base::MessageLoopProxy::current()); |
+// if (demuxer) { |
+// // use |demuxer|. |
+// } |
+// |
+// // When done using the object: |
+// RTCVideoDecoderBridgeTv::Get()->ReleaseOwnership(); |
ycheo (away)
2013/05/06 05:45:34
How about adding DestroyDemuxer() into the example
wonsik
2013/05/06 12:28:43
Oops. I forgot to modify the example. Done.
|
+class CONTENT_EXPORT RTCVideoDecoderBridgeTv |
+ : NON_EXPORTED_BASE(public webrtc::VideoDecoder) { |
+ public: |
+ // Get RTCVideoDecoderBridgeTv singleton object. If it was not set |
+ // before, new default instance will be created. |
+ static RTCVideoDecoderBridgeTv* Get(); |
+ |
+ static void RunDestroyDemuxer(const media::Demuxer* demuxer); |
+ |
+ // Returns a demuxer object if this is not owned or owned by the same |
+ // media_stream_dependency_factory. |
+ virtual media::Demuxer* CreateDemuxer( |
+ const MediaStreamDependencyFactory* media_stream_dependency_factory, |
+ const scoped_refptr<base::MessageLoopProxy>& message_loop) = 0; |
+ |
+ virtual void DestroyDemuxer(const media::Demuxer* demuxer) = 0; |
+ |
+ // Returns true if acquired the ownership of this object successfully. One |
+ // should acquire ownership before using the object, and can't use the object |
+ // if this method fails. |
+ virtual bool AcquireOwnership( |
+ const MediaStreamDependencyFactory* media_stream_dependency_factory) = 0; |
+ |
+ // Releases ownership of this object. |
+ virtual void ReleaseOwnership( |
+ const MediaStreamDependencyFactory* media_stream_dependency_factory) = 0; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_ |