Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1296)

Unified Diff: content/browser/renderer_host/media/audio_input_device_manager.cc

Issue 10790121: First step towards moving AudioDevice from content/ to media/audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comments after closing ppapi bug Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/audio_input_device_manager.cc
diff --git a/content/browser/renderer_host/media/audio_input_device_manager.cc b/content/browser/renderer_host/media/audio_input_device_manager.cc
index 09350908fd34fe2828b7d45dcfada11676d47ad6..42728f7f42079b2f1341ed34b3457f1f000909c1 100644
--- a/content/browser/renderer_host/media/audio_input_device_manager.cc
+++ b/content/browser/renderer_host/media/audio_input_device_manager.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "content/browser/renderer_host/media/audio_input_device_manager_event_handler.h"
#include "content/public/browser/browser_thread.h"
+#include "media/audio/audio_input_ipc.h"
#include "media/audio/audio_manager_base.h"
using content::BrowserThread;
@@ -15,8 +16,6 @@ using content::BrowserThread;
namespace media_stream {
const int AudioInputDeviceManager::kFakeOpenSessionId = 1;
-const int AudioInputDeviceManager::kInvalidSessionId = 0;
-const char AudioInputDeviceManager::kInvalidDeviceId[] = "";
// Starting id for the first capture session.
const int kFirstSessionId = AudioInputDeviceManager::kFakeOpenSessionId + 1;
@@ -158,15 +157,15 @@ void AudioInputDeviceManager::Start(
}
// Checks if the device has been opened or not.
- std::string device_id = (devices_.find(session_id) == devices_.end()) ?
- kInvalidDeviceId : devices_[session_id].unique_id;
+ std::string device_id;
// Adds the event handler to the session if the session has not been started,
- // otherwise post a |kInvalidDeviceId| to indicate that Start() fails.
- if (event_handlers_.find(session_id) == event_handlers_.end())
+ // otherwise post an empty |device_id| to indicate that Start() fails.
+ if (event_handlers_.find(session_id) == event_handlers_.end()) {
event_handlers_.insert(std::make_pair(session_id, event_handler));
- else
- device_id = kInvalidDeviceId;
+ if (devices_.find(session_id) != devices_.end())
+ device_id = devices_[session_id].unique_id;
+ }
// Posts a callback through the AudioInputRendererHost to notify the renderer
// that the device has started.

Powered by Google App Engine
This is Rietveld 408576698