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

Side by Side Diff: media/filters/media_source_state.cc

Issue 1716503002: Basic media tracks implementation for media stream parsers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added DISALLOW_COPY_AND_ASSIGN in MediaTracks Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "media/filters/media_source_state.h" 5 #include "media/filters/media_source_state.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "media/base/media_track.h"
10 #include "media/base/media_tracks.h"
9 #include "media/filters/chunk_demuxer.h" 11 #include "media/filters/chunk_demuxer.h"
10 #include "media/filters/frame_processor.h" 12 #include "media/filters/frame_processor.h"
11 #include "media/filters/source_buffer_stream.h" 13 #include "media/filters/source_buffer_stream.h"
12 14
13 namespace media { 15 namespace media {
14 16
15 enum { 17 enum {
16 // Limits the number of MEDIA_LOG() calls warning the user that a muxed stream 18 // Limits the number of MEDIA_LOG() calls warning the user that a muxed stream
17 // media segment is missing a block from at least one of the audio or video 19 // media segment is missing a block from at least one of the audio or video
18 // tracks. 20 // tracks.
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // stalled because we don't have cues. If cues, with timestamps after 463 // stalled because we don't have cues. If cues, with timestamps after
462 // the seek time, eventually arrive they will be delivered properly 464 // the seek time, eventually arrive they will be delivered properly
463 // in response to ChunkDemuxerStream::Read() calls. 465 // in response to ChunkDemuxerStream::Read() calls.
464 466
465 return false; 467 return false;
466 } 468 }
467 469
468 bool MediaSourceState::OnNewConfigs( 470 bool MediaSourceState::OnNewConfigs(
469 bool allow_audio, 471 bool allow_audio,
470 bool allow_video, 472 bool allow_video,
471 const AudioDecoderConfig& audio_config, 473 scoped_ptr<MediaTracks> tracks,
472 const VideoDecoderConfig& video_config,
473 const StreamParser::TextTrackConfigMap& text_configs) { 474 const StreamParser::TextTrackConfigMap& text_configs) {
475 DCHECK(tracks);
wolenetz 2016/02/26 00:06:21 nit: though scoped_ptr allows this IIUC, I prefer
servolk 2016/02/26 01:56:32 Done.
476 media_tracks_ = std::move(tracks);
477 const AudioDecoderConfig& audio_config = media_tracks_->getFirstAudioConfig();
478 const VideoDecoderConfig& video_config = media_tracks_->getFirstVideoConfig();
479
474 DVLOG(1) << "OnNewConfigs(" << allow_audio << ", " << allow_video << ", " 480 DVLOG(1) << "OnNewConfigs(" << allow_audio << ", " << allow_video << ", "
475 << audio_config.IsValidConfig() << ", " 481 << audio_config.IsValidConfig() << ", "
476 << video_config.IsValidConfig() << ")"; 482 << video_config.IsValidConfig() << ")";
477 DCHECK(!init_segment_received_cb_.is_null()); 483 DCHECK(!init_segment_received_cb_.is_null());
478 484
479 if (!audio_config.IsValidConfig() && !video_config.IsValidConfig()) { 485 if (!audio_config.IsValidConfig() && !video_config.IsValidConfig()) {
480 DVLOG(1) << "OnNewConfigs() : Audio & video config are not valid!"; 486 DVLOG(1) << "OnNewConfigs() : Audio & video config are not valid!";
481 return false; 487 return false;
482 } 488 }
483 489
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 break; 637 break;
632 } 638 }
633 } 639 }
634 } 640 }
635 } 641 }
636 642
637 frame_processor_->SetAllTrackBuffersNeedRandomAccessPoint(); 643 frame_processor_->SetAllTrackBuffersNeedRandomAccessPoint();
638 644
639 DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed"); 645 DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed");
640 if (success) 646 if (success)
641 init_segment_received_cb_.Run(); 647 init_segment_received_cb_.Run(*media_tracks_);
642 648
643 return success; 649 return success;
644 } 650 }
645 651
646 void MediaSourceState::OnNewMediaSegment() { 652 void MediaSourceState::OnNewMediaSegment() {
647 DVLOG(2) << "OnNewMediaSegment()"; 653 DVLOG(2) << "OnNewMediaSegment()";
648 parsing_media_segment_ = true; 654 parsing_media_segment_ = true;
649 media_segment_contained_audio_frame_ = false; 655 media_segment_contained_audio_frame_ = false;
650 media_segment_contained_video_frame_ = false; 656 media_segment_contained_video_frame_ = false;
651 } 657 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 return true; 721 return true;
716 } 722 }
717 723
718 void MediaSourceState::OnSourceInitDone( 724 void MediaSourceState::OnSourceInitDone(
719 const StreamParser::InitParameters& params) { 725 const StreamParser::InitParameters& params) {
720 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; 726 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset;
721 base::ResetAndReturn(&init_cb_).Run(params); 727 base::ResetAndReturn(&init_cb_).Run(params);
722 } 728 }
723 729
724 } // namespace media 730 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698