| Index: content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.h b/content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| similarity index 39%
|
| copy from content/renderer/pepper/pepper_media_stream_video_track_host.h
|
| copy to content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| index 588c7edab81ca59d66f7a8c443ea4f365d3dc7e2..83a557db69f24ceb5ba77d10dfcc2426ec4796e9 100644
|
| --- a/content/renderer/pepper/pepper_media_stream_video_track_host.h
|
| +++ b/content/renderer/pepper/pepper_media_stream_audio_track_host.h
|
| @@ -1,36 +1,46 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 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 CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_
|
| -#define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_
|
| +#ifndef CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_
|
| +#define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_
|
|
|
| #include "base/compiler_specific.h"
|
| -#include "content/public/renderer/media_stream_video_sink.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "content/public/renderer/media_stream_audio_sink.h"
|
| #include "content/renderer/pepper/pepper_media_stream_track_host_base.h"
|
| -#include "media/base/video_frame.h"
|
| +#include "media/audio/audio_parameters.h"
|
| #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
|
| -#include "ui/gfx/size.h"
|
| +
|
| +namespace base {
|
| +class MessageLoopProxy;
|
| +} // namespace base
|
|
|
| namespace content {
|
|
|
| -class PepperMediaStreamVideoTrackHost : public PepperMediaStreamTrackHostBase,
|
| - public MediaStreamVideoSink {
|
| +class PepperMediaStreamAudioTrackHost : public PepperMediaStreamTrackHostBase,
|
| + public MediaStreamAudioSink {
|
| public:
|
| - PepperMediaStreamVideoTrackHost(RendererPpapiHost* host,
|
| + PepperMediaStreamAudioTrackHost(RendererPpapiHost* host,
|
| PP_Instance instance,
|
| PP_Resource resource,
|
| const blink::WebMediaStreamTrack& track);
|
|
|
| private:
|
| - virtual ~PepperMediaStreamVideoTrackHost();
|
| + virtual ~PepperMediaStreamAudioTrackHost();
|
| +
|
| + void InitFramesOnMainThread(uint32_t number_of_frames, uint32_t frame_size);
|
|
|
| // PepperMediaStreamTrackHostBase overrides:
|
| virtual void OnClose() OVERRIDE;
|
|
|
| - // MediaStreamVideoSink overrides:
|
| - virtual void OnVideoFrame(
|
| - const scoped_refptr<media::VideoFrame>& frame) OVERRIDE;
|
| + // MediaStreamAudioSink overrides:
|
| + virtual void OnData(const int16* audio_data,
|
| + int sample_rate,
|
| + int number_of_channels,
|
| + int number_of_frames) OVERRIDE;
|
| + virtual void OnSetFormat(const media::AudioParameters& params) OVERRIDE;
|
|
|
| // ResourceHost overrides:
|
| virtual void DidConnectPendingHostToResource() OVERRIDE;
|
| @@ -40,18 +50,24 @@ class PepperMediaStreamVideoTrackHost : public PepperMediaStreamTrackHostBase,
|
| // True if it has been added to |blink::WebMediaStreamTrack| as a sink.
|
| bool connected_;
|
|
|
| - // Frame size.
|
| - gfx::Size frame_size_;
|
| + // Timestamp of the next received audio frame.
|
| + base::TimeDelta timestamp_;
|
| +
|
| + // Duration of one audio frame.
|
| + base::TimeDelta frame_duration_;
|
|
|
| - // Frame format.
|
| - media::VideoFrame::Format frame_format_;
|
| + media::AudioParameters audio_params_;
|
|
|
| // The size of frame pixels in bytes.
|
| uint32_t frame_data_size_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(PepperMediaStreamVideoTrackHost);
|
| + scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_;
|
| +
|
| + base::WeakPtrFactory<PepperMediaStreamAudioTrackHost> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PepperMediaStreamAudioTrackHost);
|
| };
|
|
|
| } // namespace content
|
|
|
| -#endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_
|
| +#endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_AUDIO_TRACK_HOST_H_
|
|
|