Chromium Code Reviews| Index: chrome/browser/media/media_stream_capture_indicator.cc |
| diff --git a/chrome/browser/media/media_stream_capture_indicator.cc b/chrome/browser/media/media_stream_capture_indicator.cc |
| index c57ef7072ac4d8bf731075491a729f50339a089c..4bedce6a01adead9e48646dd5a32c836a22a7ac0 100644 |
| --- a/chrome/browser/media/media_stream_capture_indicator.cc |
| +++ b/chrome/browser/media/media_stream_capture_indicator.cc |
| @@ -423,28 +423,28 @@ void MediaStreamCaptureIndicator::RemoveCaptureDeviceTab( |
| int render_view_id, |
| const content::MediaStreamDevices& devices) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - |
| CaptureDeviceTabs::iterator iter = std::find_if( |
| tabs_.begin(), tabs_.end(), TabEquals(render_process_id, render_view_id)); |
| - DCHECK(iter != tabs_.end()); |
| - content::MediaStreamDevices::const_iterator dev = devices.begin(); |
| - for (; dev != devices.end(); ++dev) { |
| - DCHECK(dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE || |
| - dev->type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE); |
| - if (dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) |
| - --iter->audio_ref_count; |
| - else |
| - --iter->video_ref_count; |
| + if (iter != tabs_.end()) { |
|
Ami GONE FROM CHROMIUM
2012/08/24 17:57:57
Do you understand how it can happen that this is =
no longer working on chromium
2012/08/24 18:09:58
Yes. This happens when we have multiple tabs using
|
| + content::MediaStreamDevices::const_iterator dev = devices.begin(); |
| + for (; dev != devices.end(); ++dev) { |
| + DCHECK(dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE || |
| + dev->type == content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE); |
| + if (dev->type == content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) |
| + --iter->audio_ref_count; |
| + else |
| + --iter->video_ref_count; |
| + |
| + DCHECK_GE(iter->audio_ref_count, 0); |
| + DCHECK_GE(iter->video_ref_count, 0); |
| + } |
| - DCHECK_GE(iter->audio_ref_count, 0); |
| - DCHECK_GE(iter->video_ref_count, 0); |
| + // Remove the tab if all the devices have been closed. |
| + if (iter->audio_ref_count == 0 && iter->video_ref_count == 0) |
| + tabs_.erase(iter); |
| } |
| - // Remove the tab if all the devices have been closed. |
| - if (iter->audio_ref_count == 0 && iter->video_ref_count == 0) |
| - tabs_.erase(iter); |
| - |
| UpdateStatusTrayIconContextMenu(); |
|
Ami GONE FROM CHROMIUM
2012/08/24 17:57:57
Do you want to do this even if iter==tabs_.end() (
no longer working on chromium
2012/08/24 18:09:58
Good question, I think both ways work the same. Bu
Ami GONE FROM CHROMIUM
2012/08/24 18:21:41
I don't know the code to make a call. It's up to
|
| } |