Chromium Code Reviews| 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..372fdc9bb4b41250ea3446f02c82afc04b72f46e |
| --- /dev/null |
| +++ b/content/renderer/media/rtc_video_decoder_bridge_tv.h |
| @@ -0,0 +1,73 @@ |
| +// 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: |
| +// |
| +// MediaStreamDependencyFactory* tag = ...; |
| +// |
| +// // Before using the object: |
| +// if (!RTCVideoDecoderBridgeTv::Get()->AcquireOwnership(tag)) |
| +// return; |
| +// |
| +// media::Demuxer* demuxer = RTCVideoDecoderBridgeTv::Get()->CreateDemuxer( |
| +// tag, base::MessageLoopProxy::current()); |
| +// if (demuxer) { |
| +// // use |demuxer|. |
| +// } |
| +// |
| +// // When done using the object: |
| +// // NOTE: the order is not significant. |
|
Ami GONE FROM CHROMIUM
2013/05/08 20:26:44
Then why not make ReleaseOwnership implicitly call
wonsik
2013/05/13 14:03:48
Obsolete after redesign
|
| +// RTCVideoDecoderBridgeTv::Get()->DestroyDemuxer(demuxer); |
| +// RTCVideoDecoderBridgeTv::Get()->ReleaseOwnership(tag); |
| +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(); |
| + |
| + // 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, |
|
Ami GONE FROM CHROMIUM
2013/05/08 20:26:44
I'm still pretty unhappy about this business with
wonsik
2013/05/13 14:03:48
Redesigned following your advice.
|
| + const scoped_refptr<base::MessageLoopProxy>& message_loop) = 0; |
| + |
| + // Destroys the demuxer, owned by this object. |
| + 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_ |