Skip to content

Commit

Permalink
Revert 130180 - Move media/audio files into media namespace
Browse files Browse the repository at this point in the history
BUG=115187
TEST=compiles and runs without breaking audio tag; media_unittests, content_unittests

Review URL: https://chromiumcodereview.appspot.com/9805001

TBR=vrk@google.com
Review URL: https://chromiumcodereview.appspot.com/9965076

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130182 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
vrk@google.com committed Apr 2, 2012
1 parent 897bfb5 commit f3a1b85
Show file tree
Hide file tree
Showing 128 changed files with 203 additions and 535 deletions.
4 changes: 2 additions & 2 deletions content/browser/browser_main_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void ImmediateShutdownAndExitProcess() {
}

// static
media::AudioManager* BrowserMainLoop::GetAudioManager() {
AudioManager* BrowserMainLoop::GetAudioManager() {
return g_current_browser_main_loop->audio_manager_.get();
}

Expand Down Expand Up @@ -327,7 +327,7 @@ void BrowserMainLoop::MainMessageLoopStart() {
hi_res_timer_manager_.reset(new HighResolutionTimerManager);

network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
audio_manager_.reset(media::AudioManager::Create());
audio_manager_.reset(AudioManager::Create());
online_state_observer_.reset(new BrowserOnlineStateObserver);

#if defined(OS_WIN)
Expand Down
9 changes: 3 additions & 6 deletions content/browser/browser_main_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ui/base/win/scoped_ole_initializer.h"
#endif

class AudioManager;
class BrowserOnlineStateObserver;
class CommandLine;
class HighResolutionTimerManager;
Expand All @@ -24,10 +25,6 @@ namespace base {
class SystemMonitor;
}

namespace media {
class AudioManager;
}

namespace net {
class NetworkChangeNotifier;
}
Expand Down Expand Up @@ -69,7 +66,7 @@ class BrowserMainLoop {
int GetResultCode() const { return result_code_; }

// Can be called on any thread.
static media::AudioManager* GetAudioManager();
static AudioManager* GetAudioManager();

private:
// For ShutdownThreadsAndCleanUp.
Expand All @@ -92,7 +89,7 @@ class BrowserMainLoop {
scoped_ptr<base::SystemMonitor> system_monitor_;
scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_;
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
scoped_ptr<media::AudioManager> audio_manager_;
scoped_ptr<AudioManager> audio_manager_;
// Per-process listener for online state changes.
scoped_ptr<BrowserOnlineStateObserver> online_state_observer_;
#if defined(OS_WIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ const char AudioInputDeviceManager::kInvalidDeviceId[] = "";
// Starting id for the first capture session.
const int kFirstSessionId = AudioInputDeviceManager::kFakeOpenSessionId + 1;

AudioInputDeviceManager::AudioInputDeviceManager(
media::AudioManager* audio_manager)
AudioInputDeviceManager::AudioInputDeviceManager(AudioManager* audio_manager)
: listener_(NULL),
next_capture_session_id_(kFirstSessionId),
audio_manager_(audio_manager) {
Expand Down Expand Up @@ -128,7 +127,7 @@ void AudioInputDeviceManager::Start(
// the callback immediately.
if (session_id == kFakeOpenSessionId) {
event_handler->OnDeviceStarted(session_id,
media::AudioManagerBase::kDefaultDeviceId);
AudioManagerBase::kDefaultDeviceId);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include "content/common/media/media_stream_options.h"
#include "media/audio/audio_device_name.h"

namespace media {
class AudioManager;
}

namespace media_stream {

Expand All @@ -41,7 +39,7 @@ class CONTENT_EXPORT AudioInputDeviceManager
static const int kInvalidSessionId;
static const char kInvalidDeviceId[];

explicit AudioInputDeviceManager(media::AudioManager* audio_manager);
explicit AudioInputDeviceManager(AudioManager* audio_manager);

// MediaStreamProvider implementation, called on IO thread.
virtual void Register(MediaStreamProviderListener* listener) OVERRIDE;
Expand Down Expand Up @@ -74,7 +72,7 @@ class CONTENT_EXPORT AudioInputDeviceManager
typedef std::map<int, media::AudioDeviceName> AudioInputDeviceMap;
AudioInputDeviceMap devices_;
// TODO(tommi): Is it necessary to store this as a member?
media::AudioManager* audio_manager_;
AudioManager* audio_manager_;

DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class AudioInputDeviceManagerTest : public testing::Test {
message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO));
io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO,
message_loop_.get()));
audio_manager_.reset(media::AudioManager::Create());
audio_manager_.reset(AudioManager::Create());

manager_ = new AudioInputDeviceManager(audio_manager_.get());
audio_input_listener_.reset(new MockAudioInputDeviceManagerListener());
Expand All @@ -129,7 +129,7 @@ class AudioInputDeviceManagerTest : public testing::Test {
scoped_ptr<BrowserThreadImpl> io_thread_;
scoped_refptr<AudioInputDeviceManager> manager_;
scoped_ptr<MockAudioInputDeviceManagerListener> audio_input_listener_;
scoped_ptr<media::AudioManager> audio_manager_;
scoped_ptr<AudioManager> audio_manager_;

private:
DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManagerTest);
Expand Down Expand Up @@ -414,11 +414,11 @@ TEST_F(AudioInputDeviceManagerTest, StartDeviceTwice) {
manager_->Start(second_session_id, second_event_handler.get());
EXPECT_CALL(*first_event_handler,
DeviceStarted(first_session_id,
media::AudioManagerBase::kDefaultDeviceId))
AudioManagerBase::kDefaultDeviceId))
.Times(1);
EXPECT_CALL(*second_event_handler,
DeviceStarted(second_session_id,
media::AudioManagerBase::kDefaultDeviceId))
AudioManagerBase::kDefaultDeviceId))
.Times(1);
message_loop_->RunAllPending();

Expand Down Expand Up @@ -502,7 +502,7 @@ TEST_F(AudioInputDeviceManagerTest, StartSessionTwice) {
manager_->Start(session_id, audio_input_event_handler.get());
EXPECT_CALL(*audio_input_event_handler,
DeviceStarted(session_id,
media::AudioManagerBase::kDefaultDeviceId))
AudioManagerBase::kDefaultDeviceId))
.Times(1);
message_loop_->RunAllPending();

Expand Down
21 changes: 11 additions & 10 deletions content/browser/renderer_host/media/audio_input_renderer_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AudioInputRendererHost::AudioEntry::~AudioEntry() {}

AudioInputRendererHost::AudioInputRendererHost(
content::ResourceContext* resource_context,
media::AudioManager* audio_manager)
AudioManager* audio_manager)
: resource_context_(resource_context),
audio_manager_(audio_manager) {
}
Expand Down Expand Up @@ -114,8 +114,8 @@ void AudioInputRendererHost::DoCompleteCreation(
return;
}

media::AudioInputSyncWriter* writer =
static_cast<media::AudioInputSyncWriter*>(entry->writer.get());
AudioInputSyncWriter* writer =
static_cast<AudioInputSyncWriter*>(entry->writer.get());

#if defined(OS_WIN)
base::SyncSocket::Handle foreign_socket_handle;
Expand Down Expand Up @@ -197,23 +197,24 @@ void AudioInputRendererHost::OnStartDevice(int stream_id, int session_id) {
audio_input_man->Start(session_id, this);
}

void AudioInputRendererHost::OnCreateStream(
int stream_id, const media::AudioParameters& params,
const std::string& device_id, bool automatic_gain_control) {
void AudioInputRendererHost::OnCreateStream(int stream_id,
const AudioParameters& params,
const std::string& device_id,
bool automatic_gain_control) {
VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id="
<< stream_id << ")";
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(LookupById(stream_id) == NULL);

media::AudioParameters audio_params(params);
AudioParameters audio_params(params);

DCHECK_GT(audio_params.frames_per_buffer(), 0);
uint32 buffer_size = audio_params.GetBytesPerBuffer();

// Create a new AudioEntry structure.
scoped_ptr<AudioEntry> entry(new AudioEntry());

uint32 mem_size = sizeof(media::AudioInputBufferParameters) + buffer_size;
uint32 mem_size = sizeof(AudioInputBufferParameters) + buffer_size;

// Create the shared memory and share it with the renderer process
// using a new SyncWriter object.
Expand All @@ -223,8 +224,8 @@ void AudioInputRendererHost::OnCreateStream(
return;
}

scoped_ptr<media::AudioInputSyncWriter> writer(
new media::AudioInputSyncWriter(&entry->shared_memory));
scoped_ptr<AudioInputSyncWriter> writer(
new AudioInputSyncWriter(&entry->shared_memory));

if (!writer->Init()) {
SendErrorMessage(stream_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ namespace content {
class ResourceContext;
}

namespace media {
class AudioManager;
class AudioParameters;
}

class CONTENT_EXPORT AudioInputRendererHost
: public content::BrowserMessageFilter,
Expand Down Expand Up @@ -101,7 +99,7 @@ class CONTENT_EXPORT AudioInputRendererHost

// Called from UI thread from the owner of this object.
AudioInputRendererHost(content::ResourceContext* resource_context,
media::AudioManager* audio_manager);
AudioManager* audio_manager);

// content::BrowserMessageFilter implementation.
virtual void OnChannelClosing() OVERRIDE;
Expand Down Expand Up @@ -141,7 +139,7 @@ class CONTENT_EXPORT AudioInputRendererHost
// successful this object would keep an internal entry of the stream for the
// required properties.
void OnCreateStream(int stream_id,
const media::AudioParameters& params,
const AudioParameters& params,
const std::string& device_id,
bool automatic_gain_control);

Expand Down Expand Up @@ -199,7 +197,7 @@ class CONTENT_EXPORT AudioInputRendererHost

// Used to get an instance of AudioInputDeviceManager.
content::ResourceContext* resource_context_;
media::AudioManager* audio_manager_;
AudioManager* audio_manager_;

// A map of stream IDs to audio sources.
typedef std::map<int, AudioEntry*> AudioEntryMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include "base/process_util.h"
#include "base/shared_memory.h"

namespace media {

AudioInputSyncWriter::AudioInputSyncWriter(base::SharedMemory* shared_memory)
: shared_memory_(shared_memory) {
}
Expand Down Expand Up @@ -66,5 +64,3 @@ bool AudioInputSyncWriter::PrepareForeignSocketHandle(
}

#endif

} // namespace media
3 changes: 0 additions & 3 deletions content/browser/renderer_host/media/audio_input_sync_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace base {
class SharedMemory;
}

namespace media {
// A AudioInputController::SyncWriter implementation using SyncSocket. This
// is used by AudioInputController to provide a low latency data source for
// transmitting audio packets between the browser process and the renderer
Expand Down Expand Up @@ -52,6 +51,4 @@ class AudioInputSyncWriter : public media::AudioInputController::SyncWriter {
DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter);
};

} // namespace media

#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_
6 changes: 3 additions & 3 deletions content/browser/renderer_host/media/audio_renderer_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AudioRendererHost::AudioEntry::~AudioEntry() {}
///////////////////////////////////////////////////////////////////////////////
// AudioRendererHost implementations.
AudioRendererHost::AudioRendererHost(
media::AudioManager* audio_manager,
AudioManager* audio_manager,
content::MediaObserver* media_observer)
: audio_manager_(audio_manager),
media_observer_(media_observer) {
Expand Down Expand Up @@ -192,11 +192,11 @@ bool AudioRendererHost::OnMessageReceived(const IPC::Message& message,
}

void AudioRendererHost::OnCreateStream(
int stream_id, const media::AudioParameters& params) {
int stream_id, const AudioParameters& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(LookupById(stream_id) == NULL);

media::AudioParameters audio_params(params);
AudioParameters audio_params(params);
DCHECK_GT(audio_params.frames_per_buffer(), 0);

uint32 buffer_size = audio_params.GetBytesPerBuffer();
Expand Down
14 changes: 6 additions & 8 deletions content/browser/renderer_host/media/audio_renderer_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,14 @@
#include "media/audio/audio_output_controller.h"
#include "media/audio/simple_sources.h"

class AudioManager;
class AudioParameters;

namespace content {
class MediaObserver;
class ResourceContext;
} // namespace content

namespace media {
class AudioManager;
class AudioParameters;
}

class CONTENT_EXPORT AudioRendererHost
: public content::BrowserMessageFilter,
public media::AudioOutputController::EventHandler {
Expand Down Expand Up @@ -91,7 +89,7 @@ class CONTENT_EXPORT AudioRendererHost
typedef std::map<int, AudioEntry*> AudioEntryMap;

// Called from UI thread from the owner of this object.
AudioRendererHost(media::AudioManager* audio_manager,
AudioRendererHost(AudioManager* audio_manager,
content::MediaObserver* media_observer);

// content::BrowserMessageFilter implementation.
Expand Down Expand Up @@ -123,7 +121,7 @@ class CONTENT_EXPORT AudioRendererHost
// Creates an audio output stream with the specified format. If this call is
// successful this object would keep an internal entry of the stream for the
// required properties.
void OnCreateStream(int stream_id, const media::AudioParameters& params);
void OnCreateStream(int stream_id, const AudioParameters& params);

// Play the audio stream referenced by |stream_id|.
void OnPlayStream(int stream_id);
Expand Down Expand Up @@ -180,7 +178,7 @@ class CONTENT_EXPORT AudioRendererHost
// A map of stream IDs to audio sources.
AudioEntryMap audio_entries_;

media::AudioManager* audio_manager_;
AudioManager* audio_manager_;
content::MediaObserver* media_observer_;

DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
Expand Down
Loading

0 comments on commit f3a1b85

Please sign in to comment.