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

Side by Side Diff: media/formats/mpeg/mpeg_audio_stream_parser_base.cc

Issue 1091293005: MSE: Relax the 'media segment must begin with keyframe' requirement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Checkpoint. Not ready for review yet. Created 5 years, 3 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 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/mpeg/mpeg_audio_stream_parser_base.h" 5 #include "media/formats/mpeg/mpeg_audio_stream_parser_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/base/stream_parser_buffer.h" 10 #include "media/base/stream_parser_buffer.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 codec_delay_(codec_delay) {} 53 codec_delay_(codec_delay) {}
54 54
55 MPEGAudioStreamParserBase::~MPEGAudioStreamParserBase() {} 55 MPEGAudioStreamParserBase::~MPEGAudioStreamParserBase() {}
56 56
57 void MPEGAudioStreamParserBase::Init( 57 void MPEGAudioStreamParserBase::Init(
58 const InitCB& init_cb, 58 const InitCB& init_cb,
59 const NewConfigCB& config_cb, 59 const NewConfigCB& config_cb,
60 const NewBuffersCB& new_buffers_cb, 60 const NewBuffersCB& new_buffers_cb,
61 bool ignore_text_tracks, 61 bool ignore_text_tracks,
62 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 62 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
63 const NewMediaSegmentCB& new_segment_cb, 63 const base::Closure& start_of_segment_cb,
64 const base::Closure& end_of_segment_cb, 64 const base::Closure& end_of_segment_cb,
65 const scoped_refptr<MediaLog>& media_log) { 65 const scoped_refptr<MediaLog>& media_log) {
66 DVLOG(1) << __FUNCTION__; 66 DVLOG(1) << __FUNCTION__;
67 DCHECK_EQ(state_, UNINITIALIZED); 67 DCHECK_EQ(state_, UNINITIALIZED);
68 init_cb_ = init_cb; 68 init_cb_ = init_cb;
69 config_cb_ = config_cb; 69 config_cb_ = config_cb;
70 new_buffers_cb_ = new_buffers_cb; 70 new_buffers_cb_ = new_buffers_cb;
71 new_segment_cb_ = new_segment_cb; 71 start_of_segment_cb_ = start_of_segment_cb;
72 end_of_segment_cb_ = end_of_segment_cb; 72 end_of_segment_cb_ = end_of_segment_cb;
73 media_log_ = media_log; 73 media_log_ = media_log;
74 74
75 ChangeState(INITIALIZED); 75 ChangeState(INITIALIZED);
76 } 76 }
77 77
78 void MPEGAudioStreamParserBase::Flush() { 78 void MPEGAudioStreamParserBase::Flush() {
79 DVLOG(1) << __FUNCTION__; 79 DVLOG(1) << __FUNCTION__;
80 DCHECK_NE(state_, UNINITIALIZED); 80 DCHECK_NE(state_, UNINITIALIZED);
81 queue_.Reset(); 81 queue_.Reset();
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 return 0; 392 return 0;
393 } 393 }
394 394
395 bool MPEGAudioStreamParserBase::SendBuffers(BufferQueue* buffers, 395 bool MPEGAudioStreamParserBase::SendBuffers(BufferQueue* buffers,
396 bool end_of_segment) { 396 bool end_of_segment) {
397 DCHECK(!buffers->empty()); 397 DCHECK(!buffers->empty());
398 398
399 if (!in_media_segment_) { 399 if (!in_media_segment_) {
400 in_media_segment_ = true; 400 in_media_segment_ = true;
401 new_segment_cb_.Run(); 401 start_of_segment_cb_.Run();
402 } 402 }
403 403
404 BufferQueue empty_video_buffers; 404 BufferQueue empty_video_buffers;
405 TextBufferQueueMap empty_text_map; 405 TextBufferQueueMap empty_text_map;
406 if (!new_buffers_cb_.Run(*buffers, empty_video_buffers, empty_text_map)) 406 if (!new_buffers_cb_.Run(*buffers, empty_video_buffers, empty_text_map))
407 return false; 407 return false;
408 buffers->clear(); 408 buffers->clear();
409 409
410 if (end_of_segment) { 410 if (end_of_segment) {
411 in_media_segment_ = false; 411 in_media_segment_ = false;
412 end_of_segment_cb_.Run(); 412 end_of_segment_cb_.Run();
413 } 413 }
414 414
415 timestamp_helper_->SetBaseTimestamp(base::TimeDelta()); 415 timestamp_helper_->SetBaseTimestamp(base::TimeDelta());
416 return true; 416 return true;
417 } 417 }
418 418
419 } // namespace media 419 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mpeg/mpeg_audio_stream_parser_base.h ('k') | media/formats/webm/webm_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698