multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp
branchRCL_3
changeset 59 b0e4b01681c5
parent 55 f72c4fccd381
equal deleted inserted replaced
55:f72c4fccd381 59:b0e4b01681c5
    31 
    31 
    32 // CONSTANTS
    32 // CONSTANTS
    33 
    33 
    34 const TInt KMccMaxNumTimestamps = 5;
    34 const TInt KMccMaxNumTimestamps = 5;
    35 
    35 
    36 // used for Calculate Average Timestamp
    36 const TInt KMccTimestampDifferenceMultiplier = 10;
    37 const TInt KMccDefaultAvgTimestampDiff = 66000;
       
    38 
    37 
    39 // ============================ MEMBER FUNCTIONS ===============================
    38 // ============================ MEMBER FUNCTIONS ===============================
    40 
    39 
    41 // -----------------------------------------------------------------------------
    40 // -----------------------------------------------------------------------------
    42 // CMccFileSink::NewSinkL
    41 // CMccFileSink::NewSinkL
    70 // -----------------------------------------------------------------------------
    69 // -----------------------------------------------------------------------------
    71 // CMccFileSink::CMccFileSink
    70 // CMccFileSink::CMccFileSink
    72 // -----------------------------------------------------------------------------
    71 // -----------------------------------------------------------------------------
    73 //
    72 //
    74 CMccFileSink::CMccFileSink() : 
    73 CMccFileSink::CMccFileSink() : 
    75     CMccDataSink( KMccFileSinkUid ),
    74     CMccDataSink( KMccFileSinkUid )
    76     iCurrAvgTimestampDifference( KMccDefaultAvgTimestampDiff )
       
    77     {
    75     {
    78     iVideoCodec.iFourCC = TFourCC( KMccFourCCIdH263 );
    76     iVideoCodec.iFourCC = TFourCC( KMccFourCCIdH263 );
    79     // FJKI-7J58CB no use case for audio in file, hence removing the audio track capability 
    77     // FJKI-7J58CB no use case for audio in file, hence removing the audio track capability 
    80     //             per request from customer
    78     //             per request from customer
    81     // iAudioFourCC = TFourCC( KMccFourCCIdAMRNB );
    79     // iAudioFourCC = TFourCC( KMccFourCCIdAMRNB );
   565                averageTimeStampDifference += ( iTimestamps[ i ] - iTimestamps[ i - 1 ] );
   563                averageTimeStampDifference += ( iTimestamps[ i ] - iTimestamps[ i - 1 ] );
   566                }
   564                }
   567                
   565                
   568        averageTimeStampDifference = averageTimeStampDifference / ( KMccMaxNumTimestamps - 1 );
   566        averageTimeStampDifference = averageTimeStampDifference / ( KMccMaxNumTimestamps - 1 );
   569        }
   567        }
   570     if ( averageTimeStampDifference > 0 )
       
   571 	   {
       
   572 	   iCurrAvgTimestampDifference = averageTimeStampDifference;
       
   573        }
       
   574     
   568     
   575     if ( aCurrentTimestamp > iPreviousTimestamp )
   569     if ( aCurrentTimestamp > iPreviousTimestamp )
   576        {
   570        {
   577        if ( iTimestamps.Count() >= KMccMaxNumTimestamps )
   571        if ( iTimestamps.Count() >= KMccMaxNumTimestamps )
   578            {
   572            {
   579            iTimestamps.Remove( 0 );
   573            iTimestamps.Remove( 0 );
   580            }
   574            }
   581        iTimestamps.AppendL( aCurrentTimestamp.Int64() );
   575        iTimestamps.AppendL( aCurrentTimestamp.Int64() );
   582        }
   576        }
   583     else if ( aCurrentTimestamp < iPreviousTimestamp )
   577     else
   584        {
   578        {
   585 	   TInt64 currDifference = iPreviousTimestamp.Int64() - aCurrentTimestamp.Int64();
   579        TInt64 currDifference = iPreviousTimestamp.Int64() - aCurrentTimestamp.Int64();
   586        iAddToTimestamp += ( currDifference + iCurrAvgTimestampDifference );
   580        if ( averageTimeStampDifference != 0 && 
   587        iTimestamps.Reset();
   581             currDifference > ( averageTimeStampDifference * KMccTimestampDifferenceMultiplier ) )
   588        iPausedDuration = 0;
   582            {
       
   583            iAddToTimestamp += ( currDifference + averageTimeStampDifference );
       
   584            iTimestamps.Reset();
       
   585 		   iPausedDuration = 0;
   589            
   586            
   590        __FILESINK_CONTROLL_INT1("CMccFileSink::TimeToPlay, iAddToTimestamp=", iAddToTimestamp )  
   587            __FILESINK_CONTROLL_INT1("CMccFileSink::TimeToPlay, iAddToTimestamp=", iAddToTimestamp )  
       
   588            }
   591        }
   589        }
   592     else
       
   593         {
       
   594         // NOP
       
   595         }
       
   596     }
   590     }
   597 
   591 
   598 // -----------------------------------------------------------------------------
   592 // -----------------------------------------------------------------------------
   599 // CMccFileSink::ResetTimers
   593 // CMccFileSink::ResetTimers
   600 // -----------------------------------------------------------------------------
   594 // -----------------------------------------------------------------------------