OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/message_loop_proxy.h" |
| 10 #include "content/common/content_export.h" |
| 11 #include "media/base/audio_decoder_config.h" |
| 12 #include "media/base/decoder_buffer_queue.h" |
| 13 #include "media/base/demuxer.h" |
| 14 #include "media/base/demuxer_stream.h" |
| 15 #include "media/base/pipeline_status.h" |
| 16 #include "media/base/video_decoder_config.h" |
| 17 #include "third_party/webrtc/modules/video_coding/codecs/interface/video_codec_i
nterface.h" |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class MediaStreamDependencyFactory; |
| 22 |
| 23 // A singleton object shared between WebMediaPlayerAndroid and WebRTC Video |
| 24 // Engine. Note that this class provides the first remote stream. |
| 25 // |
| 26 // Example use case: |
| 27 // |
| 28 // MediaStreamDependencyFactory* tag = ...; |
| 29 // |
| 30 // // Before using the object: |
| 31 // if (!RTCVideoDecoderBridgeTv::Get()->AcquireOwnership(tag)) |
| 32 // return; |
| 33 // |
| 34 // media::Demuxer* demuxer = RTCVideoDecoderBridgeTv::Get()->CreateDemuxer( |
| 35 // tag, base::MessageLoopProxy::current()); |
| 36 // if (demuxer) { |
| 37 // // use |demuxer|. |
| 38 // } |
| 39 // |
| 40 // // When done using the object: |
| 41 // // NOTE: the order is not significant. |
| 42 // RTCVideoDecoderBridgeTv::Get()->DestroyDemuxer(demuxer); |
| 43 // RTCVideoDecoderBridgeTv::Get()->ReleaseOwnership(tag); |
| 44 class CONTENT_EXPORT RTCVideoDecoderBridgeTv |
| 45 : NON_EXPORTED_BASE(public webrtc::VideoDecoder) { |
| 46 public: |
| 47 // Get RTCVideoDecoderBridgeTv singleton object. If it was not set |
| 48 // before, new default instance will be created. |
| 49 static RTCVideoDecoderBridgeTv* Get(); |
| 50 |
| 51 // Returns a demuxer object if this is not owned or owned by the same |
| 52 // media_stream_dependency_factory. |
| 53 virtual media::Demuxer* CreateDemuxer( |
| 54 const MediaStreamDependencyFactory* media_stream_dependency_factory, |
| 55 const scoped_refptr<base::MessageLoopProxy>& message_loop) = 0; |
| 56 |
| 57 // Destroys the demuxer, owned by this object. |
| 58 virtual void DestroyDemuxer(const media::Demuxer* demuxer) = 0; |
| 59 |
| 60 // Returns true if acquired the ownership of this object successfully. One |
| 61 // should acquire ownership before using the object, and can't use the object |
| 62 // if this method fails. |
| 63 virtual bool AcquireOwnership( |
| 64 const MediaStreamDependencyFactory* media_stream_dependency_factory) = 0; |
| 65 |
| 66 // Releases ownership of this object. |
| 67 virtual void ReleaseOwnership( |
| 68 const MediaStreamDependencyFactory* media_stream_dependency_factory) = 0; |
| 69 }; |
| 70 |
| 71 } // namespace content |
| 72 |
| 73 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_ |
OLD | NEW |