OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 continue; | 464 continue; |
465 client->event_handler->OnError(client->controller_id); | 465 client->event_handler->OnError(client->controller_id); |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 void VideoCaptureController::OnLog(const std::string& message) { | 469 void VideoCaptureController::OnLog(const std::string& message) { |
470 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 470 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
471 MediaStreamManager::SendMessageToNativeLog("Video capture: " + message); | 471 MediaStreamManager::SendMessageToNativeLog("Video capture: " + message); |
472 } | 472 } |
473 | 473 |
| 474 void VideoCaptureController::OnStarted() { |
| 475 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 476 state_ = VIDEO_CAPTURE_STATE_STARTED; |
| 477 |
| 478 for (const auto& client : controller_clients_) { |
| 479 if (client->session_closed) |
| 480 continue; |
| 481 client->event_handler->OnStarted(client->controller_id); |
| 482 } |
| 483 } |
| 484 |
474 void VideoCaptureController::OnBufferRetired(int buffer_id) { | 485 void VideoCaptureController::OnBufferRetired(int buffer_id) { |
475 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 486 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
476 | 487 |
477 auto buffer_context_iter = FindUnretiredBufferContextFromBufferId(buffer_id); | 488 auto buffer_context_iter = FindUnretiredBufferContextFromBufferId(buffer_id); |
478 DCHECK(buffer_context_iter != buffer_contexts_.end()); | 489 DCHECK(buffer_context_iter != buffer_contexts_.end()); |
479 | 490 |
480 // If there are any clients still using the buffer, we need to allow them | 491 // If there are any clients still using the buffer, we need to allow them |
481 // to finish up. We need to hold on to the BufferContext entry until then, | 492 // to finish up. We need to hold on to the BufferContext entry until then, |
482 // because it contains the consumer hold. | 493 // because it contains the consumer hold. |
483 if (buffer_context_iter->HasZeroConsumerHoldCount()) | 494 if (buffer_context_iter->HasZeroConsumerHoldCount()) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 if (entry_iter != std::end(client->known_buffer_context_ids)) { | 563 if (entry_iter != std::end(client->known_buffer_context_ids)) { |
553 client->known_buffer_context_ids.erase(entry_iter); | 564 client->known_buffer_context_ids.erase(entry_iter); |
554 client->event_handler->OnBufferDestroyed( | 565 client->event_handler->OnBufferDestroyed( |
555 client->controller_id, buffer_context_iter->buffer_context_id()); | 566 client->controller_id, buffer_context_iter->buffer_context_id()); |
556 } | 567 } |
557 } | 568 } |
558 buffer_contexts_.erase(buffer_context_iter); | 569 buffer_contexts_.erase(buffer_context_iter); |
559 } | 570 } |
560 | 571 |
561 } // namespace content | 572 } // namespace content |
OLD | NEW |