Permalink
Browse files

HLS: Decrease segment size from 10 to 4 seconds which should enable p…

…layback to start faster.
  • Loading branch information...
1 parent ea4bfde commit 2c71895d17c9106288e4000d7b6b441b09818a92 @stuartm stuartm committed Feb 28, 2014
@@ -121,7 +121,7 @@ HTTPLiveStream::HTTPLiveStream(QString srcFile, uint16_t width, uint16_t height,
m_audioBitrate = 64000;
if (m_segmentSize == 0)
- m_segmentSize = 10;
+ m_segmentSize = 4;
if (m_audioOnlyBitrate == 0)
m_audioOnlyBitrate = 64000;
@@ -986,7 +986,7 @@ DTC::LiveStreamInfo *Content::AddLiveStream( const QString &sStorageGroup,
HTTPLiveStream *hls = new
HTTPLiveStream(sFullFileName, nWidth, nHeight, nBitrate, nAudioBitrate,
- nMaxSegments, 10, 32000, nSampleRate);
+ nMaxSegments, 0, 0, nSampleRate);
if (!hls)
{
@@ -455,12 +455,36 @@ int Transcode::TranscodeFile(const QString &inputname,
if (hlsMode)
{
- int segmentSize = 10;
+
+ if (hlsStreamID == -1)
+ {
+ hls = new HTTPLiveStream(inputname, newWidth, newHeight,
+ cmdBitrate,
+ cmdAudioBitrate, hlsMaxSegments,
+ 0, 0);
+
+ hlsStreamID = hls->GetStreamID();
+ if (!hls || hlsStreamID == -1)
+ {
+ LOG(VB_GENERAL, LOG_ERR, "Unable to create new stream");
+ SetPlayerContext(NULL);
+ delete avfw;
+ if (avfw2)
+ delete avfw2;
+ return REENCODE_ERROR;
+ }
+ }
+
+ int segmentSize = hls->GetSegmentSize();
int audioOnlyBitrate = 0;
+ LOG(VB_GENERAL, LOG_NOTICE,
+ QString("HLS: Using segment size of %1 seconds")
+ .arg(segmentSize));
+
if (!hlsDisableAudioOnly)
{
- audioOnlyBitrate = 64000;
+ audioOnlyBitrate = hls->GetAudioOnlyBitrate();
avfw2 = new AVFormatWriter();
@@ -501,25 +525,6 @@ int Transcode::TranscodeFile(const QString &inputname,
# endif
#endif
- if (hlsStreamID == -1)
- {
- hls = new HTTPLiveStream(inputname, newWidth, newHeight,
- cmdBitrate,
- cmdAudioBitrate, hlsMaxSegments,
- segmentSize, audioOnlyBitrate);
-
- hlsStreamID = hls->GetStreamID();
- if (!hls || hlsStreamID == -1)
- {
- LOG(VB_GENERAL, LOG_ERR, "Unable to create new stream");
- SetPlayerContext(NULL);
- delete avfw;
- if (avfw2)
- delete avfw2;
- return REENCODE_ERROR;
- }
- }
-
hls->UpdateStatus(kHLSStatusStarting);
hls->UpdateStatusMessage("Transcoding Starting");
hls->UpdateSizeInfo(newWidth, newHeight, video_width, video_height);

0 comments on commit 2c71895

Please sign in to comment.