| 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 "media/mp4/mp4_stream_parser.h" | 5 #include "media/mp4/mp4_stream_parser.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12, | 230 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12, |
| 231 coded_size, visible_rect, natural_size, | 231 coded_size, visible_rect, natural_size, |
| 232 // No decoder-specific buffer needed for AVC; | 232 // No decoder-specific buffer needed for AVC; |
| 233 // SPS/PPS are embedded in the video stream | 233 // SPS/PPS are embedded in the video stream |
| 234 NULL, 0, true); | 234 NULL, 0, true); |
| 235 has_video_ = true; | 235 has_video_ = true; |
| 236 video_track_id_ = track->header.track_id; | 236 video_track_id_ = track->header.track_id; |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 // TODO(strobe): For now, we avoid sending new configs on a new | 240 RCHECK(config_cb_.Run(audio_config, video_config)); |
| 241 // reinitialization segment, and instead simply embed the updated parameter | |
| 242 // sets into the video stream. The conditional should be removed when | |
| 243 // http://crbug.com/122913 is fixed. (We detect whether we've already sent | |
| 244 // configs by looking at init_cb_ instead of config_cb_, because init_cb_ | |
| 245 // should only be fired once even after that bug is fixed.) | |
| 246 if (!init_cb_.is_null()) | |
| 247 RCHECK(config_cb_.Run(audio_config, video_config)); | |
| 248 | 241 |
| 249 base::TimeDelta duration; | 242 base::TimeDelta duration; |
| 250 if (moov_->extends.header.fragment_duration > 0) { | 243 if (moov_->extends.header.fragment_duration > 0) { |
| 251 duration = TimeDeltaFromRational(moov_->extends.header.fragment_duration, | 244 duration = TimeDeltaFromRational(moov_->extends.header.fragment_duration, |
| 252 moov_->header.timescale); | 245 moov_->header.timescale); |
| 253 } else if (moov_->header.duration > 0) { | 246 } else if (moov_->header.duration > 0) { |
| 254 duration = TimeDeltaFromRational(moov_->header.duration, | 247 duration = TimeDeltaFromRational(moov_->header.duration, |
| 255 moov_->header.timescale); | 248 moov_->header.timescale); |
| 256 } else { | 249 } else { |
| 257 duration = kInfiniteDuration(); | 250 duration = kInfiniteDuration(); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 return !err; | 463 return !err; |
| 471 } | 464 } |
| 472 | 465 |
| 473 void MP4StreamParser::ChangeState(State new_state) { | 466 void MP4StreamParser::ChangeState(State new_state) { |
| 474 DVLOG(2) << "Changing state: " << new_state; | 467 DVLOG(2) << "Changing state: " << new_state; |
| 475 state_ = new_state; | 468 state_ = new_state; |
| 476 } | 469 } |
| 477 | 470 |
| 478 } // namespace mp4 | 471 } // namespace mp4 |
| 479 } // namespace media | 472 } // namespace media |
| OLD | NEW |