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

Side by Side Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 1670033002: Reland: MSE: Relax the 'media segment must begin with keyframe' requirement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undid patch set 9's test change, since FrameProcessor *can* produce that output 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
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/formats/mp4/mp4_stream_parser.h" 5 #include "media/formats/mp4/mp4_stream_parser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 55 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
56 const NewMediaSegmentCB& new_segment_cb, 56 const NewMediaSegmentCB& new_segment_cb,
57 const EndMediaSegmentCB& end_of_segment_cb, 57 const EndMediaSegmentCB& end_of_segment_cb,
58 const scoped_refptr<MediaLog>& media_log) { 58 const scoped_refptr<MediaLog>& media_log) {
59 DCHECK_EQ(state_, kWaitingForInit); 59 DCHECK_EQ(state_, kWaitingForInit);
60 DCHECK(init_cb_.is_null()); 60 DCHECK(init_cb_.is_null());
61 DCHECK(!init_cb.is_null()); 61 DCHECK(!init_cb.is_null());
62 DCHECK(!config_cb.is_null()); 62 DCHECK(!config_cb.is_null());
63 DCHECK(!new_buffers_cb.is_null()); 63 DCHECK(!new_buffers_cb.is_null());
64 DCHECK(!encrypted_media_init_data_cb.is_null()); 64 DCHECK(!encrypted_media_init_data_cb.is_null());
65 DCHECK(!new_segment_cb.is_null());
65 DCHECK(!end_of_segment_cb.is_null()); 66 DCHECK(!end_of_segment_cb.is_null());
66 67
67 ChangeState(kParsingBoxes); 68 ChangeState(kParsingBoxes);
68 init_cb_ = init_cb; 69 init_cb_ = init_cb;
69 config_cb_ = config_cb; 70 config_cb_ = config_cb;
70 new_buffers_cb_ = new_buffers_cb; 71 new_buffers_cb_ = new_buffers_cb;
71 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb; 72 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
72 new_segment_cb_ = new_segment_cb; 73 new_segment_cb_ = new_segment_cb;
73 end_of_segment_cb_ = end_of_segment_cb; 74 end_of_segment_cb_ = end_of_segment_cb;
74 media_log_ = media_log; 75 media_log_ = media_log;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 return true; 437 return true;
437 } 438 }
438 439
439 bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers, 440 bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
440 BufferQueue* video_buffers, 441 BufferQueue* video_buffers,
441 bool* err) { 442 bool* err) {
442 DCHECK_EQ(state_, kEmittingSamples); 443 DCHECK_EQ(state_, kEmittingSamples);
443 444
444 if (!runs_->IsRunValid()) { 445 if (!runs_->IsRunValid()) {
445 // Flush any buffers we've gotten in this chunk so that buffers don't 446 // Flush any buffers we've gotten in this chunk so that buffers don't
446 // cross NewSegment() calls 447 // cross |new_segment_cb_| calls
447 *err = !SendAndFlushSamples(audio_buffers, video_buffers); 448 *err = !SendAndFlushSamples(audio_buffers, video_buffers);
448 if (*err) 449 if (*err)
449 return false; 450 return false;
450 451
451 // Remain in kEmittingSamples state, discarding data, until the end of 452 // Remain in kEmittingSamples state, discarding data, until the end of
452 // the current 'mdat' box has been appended to the queue. 453 // the current 'mdat' box has been appended to the queue.
453 if (!queue_.Trim(mdat_tail_)) 454 if (!queue_.Trim(mdat_tail_))
454 return false; 455 return false;
455 456
456 ChangeState(kParsingBoxes); 457 ChangeState(kParsingBoxes);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 runs.AdvanceSample(); 656 runs.AdvanceSample();
656 } 657 }
657 runs.AdvanceRun(); 658 runs.AdvanceRun();
658 } 659 }
659 660
660 return true; 661 return true;
661 } 662 }
662 663
663 } // namespace mp4 664 } // namespace mp4
664 } // namespace media 665 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698